Reporter |
|
---|---|
Created | Sep 2, 2009 1:51:18 PM |
Updated | Apr 6, 2018 5:21:00 PM |
Resolved | Apr 6, 2018 5:21:00 PM |
Subsystem | Quick Fixes |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Normal |
State | Obsolete |
Type | Bug |
Fix version | Backlog |
Affected versions | No Affected versions |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
I'm invoking "EndInvoke" method on Action type object, but passing parameter of a wrong type. List of quick fixes contains only "check if (...) not null", while, in my opinion it should contain proper suggestion about changing parameter type, and maybe even - not suggest checking for null, since it doesn't have any sense anyway.
here's the code:
static AsyncCallback _callbackEndInvoke = new AsyncCallback(CallBackEndInvoke);
....
action.EndInvoke(_callbackEndInvoke);
But - that's only the beginning, interesting stuff begins when I actually accept the suggestion. My parameter value is checked against null, but, R# still treats (that's correct) parameter as a wrong type argument, but unfortunately still suggest checking for null (which is incorrect in this case (aside from the fact it shouldn't have been there in the first place, cause validation is already in place). Using the suggested quick fix leads too never-ending cascade of null checks.
I enclose screenshots from Visual Studio, showing necessary variables, their types, context, etc, and then incorrect results produced by resharper
Please contact me with follow up on the reported issue.
here's the code:
static AsyncCallback _callbackEndInvoke = new AsyncCallback(CallBackEndInvoke);
....
action.EndInvoke(_callbackEndInvoke);
But - that's only the beginning, interesting stuff begins when I actually accept the suggestion. My parameter value is checked against null, but, R# still treats (that's correct) parameter as a wrong type argument, but unfortunately still suggest checking for null (which is incorrect in this case (aside from the fact it shouldn't have been there in the first place, cause validation is already in place). Using the suggested quick fix leads too never-ending cascade of null checks.
I enclose screenshots from Visual Studio, showing necessary variables, their types, context, etc, and then incorrect results produced by resharper
Please contact me with follow up on the reported issue.