I've run into issues with CodeRush Code Cleanup doing unintended things before and just ran into this one.
I got a compiler error after running it because it removed the (T) typecast below in the following code:
Codestatic T ParseOrThrow<T>(string s, string invalidMessage)
{
Type parseType = typeof(T);
MethodInfo parseMethodInfo = parseType.GetMethod("Parse", new[] { typeof(string) });
try
{
T value = **(T)**parseMethodInfo.Invoke(null, new object[] { s });
return value;
}
catch
{
throw new Exception(String.Format(invalidMessage, s));
}
}
Charles,
We were already notified about this issue. It is fixed in the next CodeRush release.
Thanks. You can close this ticket.