[MonoTouch] Using resx resources on monotouch

Rolf Bjarne Kvinge rolf at xamarin.com
Mon Mar 12 22:38:25 UTC 2012


Hi,

The crash you are seeing looks like an older bug (which version of
MonoTouch are you using?) where references got stale somehow.

Can you try doing the rename, and then delete the bin and obj directories
in all the project directories, before you rebuild. Also ensure you clean
the iOS simulator (in the main menu, "iOS Simulator -> Reset Contents and
Settings" first.

If this doesn't work you should file a bug, it's clearly a scenario that
should work.

I hope this helps,
Rolf

On Mon, Mar 12, 2012 at 11:12 PM, Felix Collins <felix at intranel.com> wrote:

>
> On 9/03/2012 11:46 a.m., Rolf Bjarne Kvinge wrote:
>
>> Hi,
>>
>> I'm pretty sure there was a bug about it, but now I can't find it.
>>
>> In any case there is a test project in this bug:
>> https://bugzilla.xamarin.com/show_bug.cgi?id=3708 you can use to see how
>> it's done there: just make sure you apply the workaround mentioned in the
>> first comment in the bug (so you don't run into the issue that bug's about).
>>
>>  Thanks for that. That test project worked fine for me so I knew it
> should all work and it lead me to figure out what was wrong.  Unfortunately
> now I'm in a bind caught between two limitations of the system.
>
> My situation is this:
>
> The project is cross platform for droid and touch with a test version on
> console for .net and mono. The resource strings are considered to be a
> cross platform part of the project and so are in the cross platform project
> (call it xplatform for arguments sake). To build xplatform for the three
> different platforms in the same solution I have three projects in the
> solution called xplatform, xplatform.MT and xplatform.MD with identical
> files but referencing different mono libs and targeting different platforms
> for the output.
>
> To get the resources to load properly it looks as though the output files
> from the three projects should all be called xplatform.dll. If I call one
> of them xplatform.MT.dll then the resourcemanager need to load that file
> for the base resources ad so the resources are no longer handled in a cross
> platform way. It is possible in the project options to have the dll
> filename set differently from the project name so I tried that. For
> xplatform.MT I set the output file to xplatform.dll. I reset the iOS
> simulator and did a rebuild all. Unfortunately there seems to be a bug in
> monodevelop or monotouch somewhere because now when the application tries
> to load it crashes on loading.  So it seems that the project name and it's
> dll filename must be the same in monotouch.
>
> Does anyone have a good idea for working around this? At the moment I'm
> considering moving the resources into the platform specific parts of the
> application despite the fact that they will all use the same files and this
> will preclude using string resources in the cross platform code (not ideal).
>
> The crash info from the application output window is below... (note that
> the executable is also called xplatform) When I change the output .dll name
> back to xplatform.MT.dll and rebuild/reset simulator then the exception
> goes away. Oh, another thing I checked was that the xplatform.dll that is
> deployed to the simulator really is the one that is targeted to monotouch
> (the files are different sizes and output to different directories to avoid
> overwriting).
>
> Launching application
> Application launched. PID = 4903
> Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll
> [External]
> Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll
> [External]
> Loaded assembly: /Developer/MonoTouch/usr/lib/mono/2.1/System.dll
> [External]
> Thread started:
> Stacktrace:
>
>  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes
> (System.Reflection.Assembly,bool) <IL 0x0002e, 0xffffffff>
>  at System.Reflection.Assembly.GetTypes () [0x00000] in
> /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:357
>  at MonoTouch.ObjCRuntime.Runtime.RegisterAssembly
> (System.Reflection.Assembly) [0x00062] in
> /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:92
>  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
> (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
>
> Native stacktrace:
>
>    0   xplatform                        0x000908ec
> mono_handle_native_sigsegv + 284
>    1   xplatform                        0x00005c88
> mono_sigsegv_signal_handler + 248
>    2   libsystem_c.dylib                   0x9c0d459b _sigtramp + 43
>    3   ???                                 0xffffffff 0x0 + 4294967295
>    4   ???                                 0x099ef64f 0x0 + 161412687
>    5   ???                                 0x099ef5b2 0x0 + 161412530
>    6   ???                                 0x099883f7 0x0 + 160990199
>    7   ???                                 0x0998873e 0x0 + 160991038
>    8   xplatform                        0x00009ff2 mono_jit_runtime_invoke
> + 722
>    9   xplatform                        0x00169eee mono_runtime_invoke +
> 126
>    10  xplatform                        0x0020267f monotouch_register + 95
>    11  xplatform                        0x002115d7 main + 2583
>    12  xplatform                        0x00003045 start + 53
>    13  ???                                 0x00000005 0x0 + 5
>
> =================================================================
> Got a SIGSEGV while executing native code. This usually indicates
> a fatal error in the mono runtime or one of the native libraries
> used by your application.
> =================================================================
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monotouch/attachments/20120312/e12804e0/attachment.html>


More information about the MonoTouch mailing list