System.ArgumentNullException while accessing .resx file from Windows 8.1 Runtime Windows Store App

SubhaMuralidharanSubhaMuralidharan USMember ✭✭

My Xamarin.Android & iOS app are in their respective stores and to add Windows Phone in its line, I am currently in process of developing Windows Phone project using Xamarin.Forms. My Windows Phone platform is Windows Runtime 8.1 Windows Store App. In order to develop the project I opened my existing Xamarin.Forms project in Visual Studio Premium 2013. Obviously I got many mismatches and one of that was target framework which was .net 4.0 for Android & iOS, since Windows Phone 8.1 requires .net 4.5, I changed my shared pcl project's target framework to 4.5.

After that I am not able to open .resx files from Windows Phone project, which I created in common code. While executing below line

string test = Test.String1;

I am getting below exception:

An exception of type 'System.ArgumentNullException' occurred in mscorlib.ni.dll but was not handled in user code

Additional information: Value cannot be null.

Exception Trace:

System.ArgumentNullException was unhandled by user code
  HResult=-2147467261
  Message=Value cannot be null.
Parameter name: format
  Source=mscorlib
  ParamName=format
  StackTrace:
       at System.String.Format(IFormatProvider provider, String format, Object[] args)
       at System.Environment.GetResourceString(String key, Object[] values)
       at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
       at App.Core.Resources.Test.get_String1()
       at App.Forms.WindowsPhoneUI.MainPage..ctor()
       at App.Forms.WindowsPhoneUI.App_Forms_WindowsPhoneUI_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage()
       at App.Forms.WindowsPhoneUI.App_Forms_WindowsPhoneUI_XamlTypeInfo.XamlUserType.ActivateInstance()
  InnerException: 

While researching I found this which I think relevant to my issue. Still I am not able to understand it fully. Is it I can't access .resx files from Windows Phone project?

If so what configuration I have to change to make it work?

Please need some help...

Answers

  • SubhaMuralidharanSubhaMuralidharan USMember ✭✭
    edited June 2015

    I resolved above issue with the help of this blog. Since I created my pcl project in Xamarin Studio even after adding **WindowsRuntimeResourceManager ** class from that blog, I was getting

    ResourceMap not found error

    Then I recreated my project in Visual Studio Premium 2013 and the exception has gone away :)

Sign In or Register to comment.