Object reference not set to an instance of an object.

Discussion in 'Microsoft ASP .NET' started by Guest, Mar 24, 2005.

  1. Guest

    Guest Guest

    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
     
    Guest, Mar 24, 2005
    #1
    1. Advertisements

  2. Guest

    Sharon Guest

    Hi 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" <> wrote in message
    news:...
    > 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
     
    Sharon, Mar 24, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Fink

    Object reference not set to an instance of an object.

    Chris Fink, Jul 3, 2003, in forum: Microsoft ASP .NET
    Replies:
    2
    Views:
    201
    David Waz...
    Jul 3, 2003
  2. yysiow
    Replies:
    1
    Views:
    175
    Kevin Spencer
    Jul 12, 2003
  3. Tim
    Replies:
    1
    Views:
    143
    Bill Priess
    Jul 17, 2003
  4. Pedro Correia
    Replies:
    0
    Views:
    283
    Pedro Correia
    Jul 25, 2003
  5. Replies:
    1
    Views:
    346
    Mark Rae [MVP]
    Sep 20, 2007
Loading...

Share This Page