string reference not set to an instance of a string

Last post 08-07-2008, 9:07 AM by Flintstone. 2 replies.
Sort Posts: Previous Next
  •  08-06-2008, 6:31 AM 42778

    string reference not set to an instance of a string

    When debugging apps that use Cute Editor we all receive the following error when pages are first loaded:
    "string reference not set to an instance of a string"
     
    You do catch the exception but it would be better if it did not occur at all ... this is an annoyance that would be very easy for your developers to fix.
     
    This is what I can gather according to the stack trace, assembly etc., this is the best I can do without access to the source code:
     
    Inside the Function a(Regex.Match) which is in the file LoadHandler.c (or LoadHandler.vb) you have a line like the following:
     
    try
      {
      CultureInfo culture = new CultureInfo(str);
      }
    catch (char* s)
      {}
     
     It would be a lot easier to find these errors if we had access to the source code ;o)
  •  08-07-2008, 12:02 AM 42796 in reply to 42778

    Re: string reference not set to an instance of a string

    Here is the source code of this part:

        try
        {     
         ci=new System.Globalization.CultureInfo(culture);
        }
        catch
        {
        }
        if(ci==null)
         ci=System.Globalization.CultureInfo.CurrentUICulture;

        texts=Impl.Resource.LoadResources(context,null,ci);

     
    Can you show me how to reproduce this error?
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-07-2008, 9:07 AM 42813 in reply to 42796

    Re: string reference not set to an instance of a string

    As far as replicating the problem it will probably be something to do with our server setup but the fix is easy ... the problem is caused because the culture string is empty or not defined.
     
    To fix it please change:
    ci=new System.Globalization.CultureInfo(culture);
     
    To:
    if(!string.IsNullOrEmpty(culture))
      {
      ci=new System.Globalization.CultureInfo(culture);
      }
     
    This would make it a little more robust as it would avoid attempts to set the culture to an empty string. It would also be nice to get to the root cause as your method of getting the culture string should not produce an empty string.
     
    We do use the following line at the beginning of each generated page in our web app:
    System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US")

    Maybe that has something to do with it.
     
    If you need any information about my setup then please let me know, you can reach via email using michael.ratcliffe@comartis.com
     
    Thanks
View as RSS news feed in XML