.NET 4.0 - CultureNotFoundException
I have migrated my ASP.NET MVC 2 project to VS 2010 + .NET 4.0. Now when i start the application i get a lot of "CultureNotFoundException" in IntelliTrace and Output/Gebug window :
A first chance exception of type 'System.Globalization.CultureNotFoundException' occurred in mscorlib.dll
I know what "A first chance exception" means, but when i try to debug(added "CultureNotFoundException" into Bebug/Exceptions[Thrown]) why ex. is thrown i got this detailed exception text:
System.Globalization.CultureNotFoundException occurred Message=Culture is not supported. Parameter name: name designer is an invalid culture identifier. Source=mscorlib ParamName=name InvalidCultureName=designer StackTrace: at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride) InnerException:
I wonder why .NET is trying to create CultureInfo with name "designer"?
Isn't it bug?
I had a similar issue with the CultureName "UserCache". To resolve this I deleted all the folders from in here:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
For other people that have this problem, this is usually an exception that is ignored.
Go to the Debug menu -> Exceptions... and ensure that you have everything unchecked for the Exception list.
This is actually by design in System.Web (at least up until .NET Framework v4.0), not necessarily the best approach, but it works.
You can find a more detailed description here, but it basically happens because ASP.NET checks every single folder to see if it contains satellite assemblies, and throws an exception otherwise.
Given that satellite assemblies live in folders with predictable names, one would wonder why they would decide to do this rather than only check folders that match the pattern, particularly since handling exceptions is rather expensive computationally compared to a simple conditional check.