MonoTouch: using embedded resx files in iPhone build

I can download and access resx files in the Simulator assemblies of my iPhone application created with MonoTouch. The resx file entry in the csproj file looks like this:

  <ItemGroup>
    <EmbeddedResource Include="MapMenu\Resources\MapMenu.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>MapMenu.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

The .resx file itself has the following entry:

  <data name="Main_Menu" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Main Menu.mm;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
  </data>

and the generated MapMenu.Designer.cs file has the following:

    internal static string Main_Menu {
        get {
            return ResourceManager.GetString("Main_Menu", resourceCulture);
        }
    }

As mentioned above, calling the Main_Menu accessor works fine on the simulator. However, on the device, it produces:

<Notice>: Unhandled Exception: System.MissingMethodException: No constructor found for System.Resources.RuntimeResourceSet::.ctor(System.IO.UnmanagedMemoryStream)
<Notice>:   at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0 
<Notice>:   at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0 
<Notice>:   at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0 
<Notice>:   at System.Resources.ResourceManager.InternalGetResourceSet (System.Globalization.CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) [0x00000] in <filename unknown>:0 
<Notice>:   at System.Resources.ResourceManager.GetString (System.String name, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0  
<Notice>:   at MapMenu.Resources.MapMenu.get_Main_Menu () [0x00000] in <filename unknown>:0 

I did some sanity checks, and I wonder if this is really missing from Monotouch.

Thank,

+1
source share
1 answer

, , . ( -nolink, mtouch , MonoDevelop.

, .

+1

Source: https://habr.com/ru/post/1771447/


All Articles