[Mono-dev] System.NullReferenceException, what does it mean?

Wade Maxfield wmaxfield at gmail.com
Mon Apr 3 14:45:13 EDT 2006


  OH!  Thanks.   Have Done.  The web page returns almost *immediately*, no
chance of a timeout.

The page is at http://ampro2:2001/shm/gdsp.php

 The contents of the page are as follows:

CRCErrorCounter: 0:CountOfMessages: 0:CRCCorrectCounter: 0:CountOfWords:
0:DownlinkMsgCount: 0:BadMsgCounter: 0:MDBFlag1: 0:MDBFlag2: 0:MDBFlag3:
0:HeadVoltage: 0:ToolVoltage: 0:Temp: 0:TestMsgCount:
0:TestMsgMissedBlockCnt: 0:BufferOverflowCounter: 0:DSPMissedSeqCnt:
0:ResetDSPVariablesFlag: 0:SendTestMsgFlag: 0:ToolCurrent: 0:Head: 0:Tail:
0:MissedErrorLogCount: 0:StartTime: 0:RunTime: 0:


  (We dump a lot of info using monkey, and parse it to show on a screen.)

Here is more information on the crash:
----------------------------------------------------------------------------------------------
maxfield at cfw7245-xp2:~/Desktop/Remote DSP Monitor/RemoteDspMonitor$ mono
--debug bin/Debug/RemoteDspMonitor.exe
Mono System.Windows.Forms Assembly [Revision: 54007; built: 2005/12/6
14:35:24]
Keyboard: United States keyboard layout (phantom key version)
Gtk colorscheme read
Polling:
http://ampro2:2001/shm/gdsp.php

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
in [0x00070] (at /home/maxfield/Desktop/Remote DSP
Monitor/RemoteDspMonitor/WebPageFetch.cs:51)
WebPageFetchSpace.GetWebPageClass:GetWebPage ()
in [0x000cd] WebPageFetchSpace.GetWebPageClass:Run ()
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
---------------------------------------------------------------------------------------------------


Here is the relevant code.  line WebPageFetch.cs:51 is indicated below with
a comment:


string host = "ampro";
int  port = 2001;
string url = "shm/gdsp.php";

GetWebPage()
   {
            UriBuilder uri = new UriBuilder("http",host,port,url);
            HttpWebRequest webRequest =
              (HttpWebRequest)WebRequest.Create(uri.ToString());
            webRequest.Timeout = 1000;
             if (Debug)
             {
            string MyUri = uri.ToString();
                 Console.WriteLine("Polling: ");
                 Console.WriteLine(MyUri);
                 //Console.WriteLine("\n");
             }



            HttpWebResponse webResponse =
              (HttpWebResponse)webRequest.GetResponse();
            Stream responseStream = webResponse.GetResponseStream();
            string responseEncoding = webResponse.ContentEncoding.Trim();

/*line 51--> */           if (responseEncoding.Length == 0)
              responseEncoding="us-ascii";

            StreamReader responseReader = new StreamReader(responseStream,
              System.Text.Encoding.GetEncoding(responseEncoding));
            return(responseReader.ReadToEnd());
}



On 4/3/06, Michael Hutchinson <m.j.hutchinson at gmail.com> wrote:
>
> >  Unhandled Exception: System.NullReferenceException: Object reference
> not
> > set to an instance of an object
> >  in <0x001c6> WebPageFetchSpace.GetWebPageClass:GetWebPage
> > ()
> >  in <0x0007b> WebPageFetchSpace.GetWebPageClass:Run ()
>
> There's not much anyone can do with that trace, especially as we don't
> have the source. If you compile with debug symbols (mcs -debug) and
> run with debugging support (mono --debug) you'll get line numbers, and
> will be able to find out what operation is causing that exception.
>
>
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060403/01e79772/attachment.html 


More information about the Mono-devel-list mailing list