"Return value of pure method is not used"
I realize the value of this warning so I don't want to turn it off, but I have a common pattern in my code that causes this warning to show up a lot when using a DbDataReader to read results from a database I get:
byte[] data = new byte[reader.GetBytes(0, 0, null, 0, 0)];
reader.GetBytes(0, 0, data, 0, data.Length); // this line gives me the warning since I'm ignoring the return value
Am I doing something wrong here? It seems like ReSharper shouldn't produce this warning for calls that have array parameters (or other non primitive types).
Please sign in to leave a comment.
Hello,
Could you please attach a screenshot demonstrating this warning? I'm afraid
I wasn't able to reproduce this behavior. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
I saw this issue to so I thought I would add an image.
*Edit I do realize this is a valid error and when I remove "FirstOrDefault" the error goes away.
Sorry for the late response. Here is a screenshot of the issue:

Because the method modifies the contents of the data array it is still useful to call without examining the return value.
I'm still seeing this in ReSharper 6.1 EAP. I would love to be able to get my solution to full green status by fixing these erroneous warnings.