1

I am getting a NullReferenceException when a String is being compared. This is only happening for one customer, but on several computers at his location. We can't reproduce this internally.

Here's is a partial stack trace of the exception:

System.NullReferenceException: Object reference not set to an instance of an object.  
at System.Globalization.CultureTableRecord.GetCultureTableRecord(String name, Boolean useUserOverride)
at System.Globalization.CultureTableRecord.GetCultureTableRecord(Int32 cultureId, Boolean useUserOverride)
at System.Globalization.CultureInfo..ctor(Int32 culture, Boolean useUserOverride)
at System.Globalization.CultureInfo.GetCultureByLCIDOrName(Int32 preferLCID, String fallbackToString)  
at System.Globalization.CultureInfo.InitUserDefaultCulture()
at System.Globalization.CultureInfo.get_UserDefaultCulture()
at System.Threading.Thread.get_CurrentCulture()
at System.String.Equals(String value, StringComparison comparisonType)  

What can cause the CultureTableRecord to become corrupt?


EDIT: Here's the method that is calling String.Equals.

public override bool Equals(object obj)
{
    var other = obj as MyObject;
    return other != null && this.FileName.Equals(other.FileName, StringComparison.CurrentCultureIgnoreCase);
}
Robert Deml
  • 12,390
  • 20
  • 65
  • 92
  • Would be better to see your work as well. Read: [What is a `NullReferenceException` and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Soner Gönül Apr 03 '15 at 13:29
  • Please provide the code and the line no. where exactly the error is throwing so we can help. only error will not help to solve problem. – Jinesh Jain Apr 03 '15 at 13:38

0 Answers0