Resharper give false positive warnings in an unsafe block

Hi,
When I use code that looks like this:
unsafe
{
int i = 10;
int* pi = &i;
*pi = *pi + 1;
}
Resharper marks the assignment to i as "Value assigned is not used in any
execution path", while actually i is referenced and then dereferenced back.
Accepting resharper's tip to "Remove redundant initializer" will erroneously
change functionality.
When I use the unary & operator on a variable, resharper should treat that
variable as potentially being read & written to, as seen in the above example, Don't you think?

Omer.

3 comments
Comment actions Permalink

Thank you for the feedback.
This issue will be fixed shortly

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Omer Mor" <no_reply@jetbrains.com> wrote in message
news:13158965.1173473354275.JavaMail.itn@is.intellij.net...

Hi,
When I use code that looks like this:
unsafe
{
int i = 10;
int* pi = &i;
*pi = *pi + 1;
}
Resharper marks the assignment to i as "Value assigned is not used in any
execution path", while actually i is referenced and then dereferenced
back.
Accepting resharper's tip to "Remove redundant initializer" will
erroneously
change functionality.
When I use the unary & operator on a variable, resharper should treat that
variable as potentially being read & written to, as seen in the above
example, Don't you think?

>

Omer.



0
Comment actions Permalink

Hello,

We appreciate your feedback.

The corresponding JIRA request has been created, and you are welcome to monitor
its status at http://www.jetbrains.net/jira/browse/RSRP-36895.

Best regards,
- Development Team.


0
Comment actions Permalink

Thank you for the quick response.
Omer.

0

Please sign in to leave a comment.