none
An exception of type 'System.NullReferenceException' occurred in PhoneApp1.DLL but was not handled in user code

    Question

  • Hai,

                 Whenever iam trying to read or write a file,iam receiving this error

    "An exception of type 'System.NullReferenceException' occurred in PhoneApp1.DLL but was not handled in user code".

    I do know where to put the put the file (that is) html file or xml file.I have placed it in Asset Folder.But it doesn't recognize the file.Can anyone pls tell me any solution with clear steps.Thanks in Advance

    Monday, November 26, 2012 7:53 AM

All replies

  • can you post the code where you try to read or write the file?

    It sounds like you are using an object without creating an instance of it, but more info is needed for us to help further.


    Darin R.

    Monday, November 26, 2012 6:26 PM
  • Hai Darin Rousseau,

                           Thanks for u r rply.Here is my Code:

     varrs = Application.GetResourceStream(newUri("read.html", UriKind.Relative));

     StreamReadersr = newStreamReader(rs.Stream);

     stringhtml = sr.ReadToEnd();

     this.MyWebBrowser.NavigateToString(html);

      In this line  StreamReadersr = newStreamReader(rs.Stream); Iam getting the Error.Can u pls tell me a solution.           

               

    Tuesday, November 27, 2012 7:55 AM
  • It sounds like the GetResourceStream is not finding "read.html" and is null when you are trying to set the stream.  Check how "read.html" is included in your project.
    Tuesday, November 27, 2012 8:20 AM
  • Hai Salzburg,

                           Thanks for the Reply.Read.html is in Root of the Project.Can u pls tell me where I have to keep the file?Thanks in Advance      

    Tuesday, November 27, 2012 9:43 AM