Friday, March 16, 2012

Object reference not set to an instance of an object.

Hello,
we developed an ASP.NET Application, then our QA Dept make a full QA in all
pages with all possible cases, after deployment and review the error log we
noticed that many of errors which make page to be crashed refered to error
(Object reference not set to an instance of an object.)
so , what is the best techniques to avoid such errors in advance?
or in other to eliminate occurence such error, because our log if filled
with it :(
RegardsHi Raed.
NullReferenceException is thrown, when you try to use an
instance of a reference type, that is null or nothing in VB.
You should check that the instance is not null, before you preform any
operation on it.
C#
if(instanceName == null)
{
Response.Write("error");
}
VB
if instanceName is nothing then
Response.Write("error")
end if
Hope this helps.
Sharon.
"Raed Sawalha" <RaedSawalha@.discussions.microsoft.com> wrote in message
news:92D0174C-CE87-4DE8-AE08-9FE0FFED71D9@.microsoft.com...
> Hello,
> we developed an ASP.NET Application, then our QA Dept make a full QA in
all
> pages with all possible cases, after deployment and review the error log
we
> noticed that many of errors which make page to be crashed refered to error
> (Object reference not set to an instance of an object.)
> so , what is the best techniques to avoid such errors in advance?
> or in other to eliminate occurence such error, because our log if filled
> with it :(
> Regards

0 comments:

Post a Comment