[738] false "possible NullReferenceException"
Hi,
I'm getting a invalid "possible NullReferenceException" warning in this
code:
if (HttpContext.Current == null)
{
throw new Exception("method must be used from within a HttpContext");
}
// invalid "possible NullReferenceException" warning
var headers = HttpContext.Current.Request.Headers;
Best Regards,
Wiebe Tijsma
Please sign in to leave a comment.
(I am using 738 as well)
I see the same issue; it doesn't even go away if you quick fix it (or closing and reopening the file).
My particular lines of code:
if (control is UserControl && HttpContext.Current != null) {
((UserControl)control).InitializeAsUserControl(HttpContext.Current.Handler as Page);
//the line above this has squigglies under HttpContext.Current
}
Right now, there problems in NRE-analysis algorithm dealing with fields and
propreties.
We are now fixnig these problems
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Bill Barry" <no_replay@jetbrains.com> wrote in message
news:19938572.1204315841658.JavaMail.itn@is.intellij.net...
>
Eugene Pasynkov (JetBrains) wrote:
Well theoretically when accessing the HttpContext.Current property twice
(without assigning it to a local variable), there is no guarantee that
it will still be assigned the second time, so it might actually be
correct behavior.
Regards, Wiebe Tijsma
Exactly.
But usually the behavour of getter is stable, so it is better not to issue
warning, which is likely false-positive
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Wiebe Tijsma" <wiebeREMOVE@CAPITALStijsma.com> wrote in message
news:fqofq4$176$1@is.intellij.net...
>> Right now, there problems in NRE-analysis algorithm dealing with fields
>> and propreties.
>> We are now fixnig these problems
>>
>
>