Where R# get NotNull information on a method parameter (RaisePostBackEvent)

Answered

I know that R# is often right about messages related to null reference but I can't figure out where it found this NotNull information (see attached picture).

Of course in my overrides if I remove the null checks, I'd get some exceptions because nothing forbid to have a null eventArgument.

This occurs in RaisePostBackEvent override from System.Web.UI.Page (= ASP.NET Web Page)

I've decompiled System.web to look at RaisePostBackEvent declaration but found no further information.

Any clue?

Thanks.

0
3 comments
Official comment

Francois

ReSharper marks the condition as always false since there is "NotNull" External Annotation for "eventArgument" parameter:

%LocalAppData%\JetBrains\Installations\ReSharperPlatformVs14_001\ExternalAnnotations\.NETFramework\System.Web\2.0.0.0.Nullness.Gen.xml 

<member name="M:System.Web.UI.Page.RaisePostBackEvent(System.Web.UI.IPostBackEventHandler,System.String)">
<parameter name="eventArgument">
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
</parameter>
</member>

And it is wrong so I filed a new ticket to YouTrack https://youtrack.jetbrains.com/issue/RSRP-458930. Feel free to follow it.

Thanks! 

Hello Francois,

Do you use Pessimistic mode in R# options? If so, there is a known issue https://youtrack.jetbrains.com/issue/RSRP-458210.

Thanks! 

0

No, I'm using Optimistic Mode.

 

0

Please sign in to leave a comment.