WinPhone Device CS0012: The type 'CultureInfo' is defined in an assembly that is not referenced. NLUniversity ✭✭

I have a problem that only occurs when starting a Windows Phone app on a device where I'm using code from this forms example:

Only when running on a Windows Phone device I get this error using CultureInfo, but not on a emulator. Every evaluation of CultureInfo related expressions result this:

error CS0012: The type 'CultureInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Globalization, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

So even the simple CultureInfo.CurrentCulture will evaluate to this error. It's actually not leading to an exception though untill a CultureInfo object is passed into the ResourceManager for retrieving a translation.

I feel my lack of understanding how the PCL's and binding works exactly is impeding me to find a solution here. I've reproduced the problem in a small project which can be found on:

I'd like to know if somebody can repro this problem with the WinPhone project on a Windows Device. The crashes occur both on Windows Phone 8.1 and Windows 10 devices.


  • VangrasVangras USMember ✭✭
    edited February 2018, I got the same exception when running on a WP 8.1 device and not in the emulator like you.

    On the same device I previously ran the app in Release mode without issues. When I tried debug I got the exception consistently. I then removed the app from the device and rebuilt in debug and it worked without exceptions. But then if I rebuilt it, it happened again. Removed the app and rebuilt, it worked again.

    It seems that if I rebuild the app once it's on the device, it happens, otherwise it works.

  • NLUniversity ✭✭

    Try this: it did the trick for me:

    I call WindowsRuntimeResourceManager.InjectIntoResxGeneratedApplicationResourcesClass(typeof(AppResources)); from the App constructor in the Windows Phone project.

  • VangrasVangras USMember ✭✭
    edited February 2018, in "WindowsRuntimeResourceManager.InjectIntoResxGeneratedApplicationResourcesClass(typeof(AppResources));" what is "AppResources"?

  • VangrasVangras USMember ✭✭
    edited March 2018

    Figured out AppResources is the localized resources file and it solved the issue (which was also happening in the release version when creating WP8 and Windows 8 packages for store upload).

    This helped to better understand the issue:

Sign In or Register to comment.