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

  •  08-07-2008, 9:07 AM

    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 Complete Thread