I get [MustUseReturnValue] warning from a method that is not annotated

I can't get rid of one ReSharper warning. I have a bunch of HtmlHelpers including one for table, that allows me to bind view model properties to columns, add html attributes and call some other column-specific functions and I'm using method-chaining.

In the .Columns(Action<ColumnFactory<TSource>> columns) method, I always get the warning: Return value of method annotated with [MustUseReturnValue] attribute is not used

But none of my code is annotated with this atrribute. As you can see in the screenshot, where is definition of the class and I also included search results from the whole solution with zero items found.

The code is mine and it doesn't inherit any 3rd party solution. So it can't come from a compiled assembly.

I thought it could be a problem with Action or Func delegates but this warning doesn't appear in the rest of my helpers that uses similar approach (as you can see at the bottom of the screenshot)

I was trying to find an attribute that would suppress this warning but there doesn't seem to be any. The only solution that works is to disable this warning in ReSharper settings. But I would like this to be enabled so that I can use this attribute and let ReSharper to warn me on other places.

So is it possible that this attribute is in some cases applied implicitly? And how can I get rid of this warning? Is it a bug?

0
3 comments
Official comment

Hello Ivana,

There is pretty similar request on YouTrack https://youtrack.jetbrains.com/issue/RSRP-463343. Feel free to follow/comment/vote for it.

Thanks! 

Avatar
Permanently deleted user

You have a typo in your search string: MusetUseReturnValue

0
Avatar
Permanently deleted user

Yes, I made this typo while preparing the screenshot. I wanted to provide as much information as possible and show that I don't use the attribute at all. It wouldn't find anything even with the corrected string. But that's not the point. The point is that a function that is not annotated returns the [MustUseReturnValue] warning.

Also, one more thing: I don't use external annotations either.

0

Please sign in to leave a comment.