[301] Two incorrect marks
Hi,
I noticed two incorrect marks in Resharper, introduced in version 2.5 build
300.
1. An error mark "Type Customlist<int, string> is not enumerable" when using
a generic list Clone() in a for-each.
2. A warning mark "Method could be made static" for some Form event
handlers.
See attached screenshots.
Regards,
Marcel
Attachment(s):
scr1.jpg
scr2.jpg
Please sign in to leave a comment.
Hello Marcel,
Could you provide the information on where the CustomList<T,U> is declared
in your solution?
The method could indeed be made static. The second warning is correct.
Best regards,
Andrey Simanovsky
Hello Andrey,
>> Hi,
>>
>> I noticed two incorrect marks in Resharper, introduced in version 2.5
>> build 300.
>>
>> 1. An error mark "Type Customlist<int, string> is not enumerable"
>> when
>> using
>> a generic list Clone() in a for-each.
>> 2. A warning mark "Method could be made static" for some Form event
>> handlers.
>>
>> See attached screenshots.
>>
>> Regards,
>> Marcel
This was already reported in 300 as a error. Resharper, correctly, does not
attempt to modify the VS IDE maintained code for Windows Forms event handler
assignments.
If you were to accept Resharper's suggestion it would modify a Paint event
handler like so:
private static void Form1_Paint(object sender, PaintEventArgs e)
{
// some code here
}
But, when you try to build, you will have a compile-time error pointing at
the offending line which will look like this one for a Paint event handler
assignment:
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
It will of course complain 'Static member 'CCompoundPens.Form1.Form1_Paint(object,
System.Windows.Forms.PaintEventArgs)' cannot be accessed with an instance
reference; qualify it with a type name instead'.
http://www.jetbrains.net/jira/browse/RSRP-31177
Hi, Andrey
Thanks for your quick reply.
1. In the project at work, the CustomList is declared in another assembly
than where it is used. But I reproduced the same error in a small solution
in which the (not fully implemented) CustomList is declared in the same file
as the form that uses the list (see attachment).
2. You are correct that the method could be made static. But if I make it
static, I have to remove "this." from Form_Load in "this.Load += new
System.eventhandler(this.Form_Load)" in the designer generated code. I think
it's better not to show this warning for generated Form event handlers.
Regards,
Marcel
"Andrey Simanovsky (JetBrains)" <ands@intellij.com> wrote in message
news:c8a8a15d1478a8c8d253768ba093@news.intellij.net...
>
>
>> Hi,
>>
>> I noticed two incorrect marks in Resharper, introduced in version 2.5
>> build 300.
>>
>> 1. An error mark "Type Customlist<int, string> is not enumerable" when
>> using
>> a generic list Clone() in a for-each.
>> 2. A warning mark "Method could be made static" for some Form event
>> handlers.
>
>> See attached screenshots.
>>
>> Regards,
>> Marcel
>
Attachment(s):
WindowsApplication2.zip
Thank you for reproducing the problem. We will inverstigate it.
Visual Studio is capable of maintaing static event handler subscription code.
All ReSharper needs is to correctly update references to the event handler
if quickfix is invoked. This issue is already present in JIRA. It will be
fixed in one of the following EAP builds.
>> Hello Marcel,
>>
>>> Hi,
>>>
>>> I noticed two incorrect marks in Resharper, introduced in version
>>> 2.5 build 300.
>>>
>>> 1. An error mark "Type Customlist<int, string> is not enumerable"
>>> when
>>> using
>>> a generic list Clone() in a for-each.
>> Could you provide the information on where the CustomList<T,U> is
>> declared in your solution?
>>
>>> 2. A warning mark "Method could be made static" for some Form event
>>> handlers.
>>>
>> The method could indeed be made static. The second warning is
>> correct.
>>
>>> See attached screenshots.
>>>
>>> Regards,
>>> Marcel
>> Best regards,
>> Andrey Simanovsky
Best regards,
Andrey Simanovsky