0

I get the below exception from GetCultureTableRecord when I try to concatenate a string and uint something like below in my code. Have no idea why it fails in here. Please help with possible info.

where x and y are declared uint

"Whatever string text: " + x + " " + y

I had this exception only once and not reproducible.

***Exception: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.Globalization.NumberFormatInfo.get_CurrentInfo()
   at System.UInt32.ToString()
   at System.String.Concat(Object[] args)***
  • The answer in the [marked duplicate](https://stackoverflow.com/q/4660142/1260204) is pretty much a "how to troubleshoot a NRE", a guidebook if you will. Use the advice in that answer to figure out what is causing the NRE in your code – Igor Nov 22 '19 at 12:30
  • I'm not asking general info. about null reference exception. Here in above mentioned line of code of concatenating string and unit there are no null values involved and actual exception is seen from _Globalization.CultureTableRecord.GetCultureTableRecord_. Does Globalization needed for concatenation ? – Chakravarthy Nov 22 '19 at 12:53
  • Check this old post: https://social.msdn.microsoft.com/Forums/vstudio/en-US/4167d77a-150e-4395-b04c-2abb83d3dac4/problem-building-solution-the-resolveassemblyreference-task-failed-unexpectedly?forum=msbuild , could be a PC registry setting that is not configured correctly. – Igor Nov 22 '19 at 13:58

0 Answers0