Consider the following code:
public class AsyncRequestHandler : IHttpAsyncHandler
{
public void EndProcessRequest(IAsyncResult result)
{
if (result == null)
{
...
}
...
}
}
ReSharper suggests that result
could never be null
(by indicating that the condition is always false). However, since IAsyncResult
is a reference type, null
is a possible value. I came up with two possibilities:
- Some kind of metadata available that allows ReSharper to conclude that
result
could never benull
. Looking at theIHttpAsyncHandler
source code using ReSharper, I don't see any attributes associated withEndProcessRequest
. - ReSharper is aware that the
IHttpAsyncHandler
guarantees thatIAsyncResult
will never benull
. However, the documentation doesn't gives any clues either way.
It seems reasonable that IAsyncResult
won't be null since it allows us to track the progress of the asynchronous task. Can someone please provide some insight?