Hello,

I came to the same conclusion after some testing. I thought that there was
something missing in Monobjc, but it appears that there is huge limitation
in the embedding API of the Mono runtime.

In the "mono/metadata/assembly.c", the "mono_assembly_open_from_bundle" is
responsible for loading requested assembly. But the lookup does not handle
the culture of the assembly. This is why, only one resources dll can be
loaded at a time.

I guess I need to produce another patch for Mono, in order to handle the
satellite assemblies loading.

Regards, Laurent Etiemble.

2009/12/21 Kenny Clement <psyki...@gmail.com>

> Hi,
>
> As you said it might've been caused by MonobjC, I just tested some more, to
> see if I could rule out MonobjC/determine for sure it was MonobjC.
>
> So, I compiled my application using Visual Studio.
> And did mkbundle manually on the commandline (instead of using the MonobjC
> NAnt task).
>
> So I didn't use MonobjC at all, and I'm still getting the same problem.
>
> It seems this is a limitation of mkbundle.
> And I can see why, it can't possibly know which assembly to use, because
> the namespaces, classname, ... is exactly the same
> However, I kind of need this to work.
> Is there another way to do what I'm doing? Some sort of workaround?
> Other people must've encountered this before.
>
> Now that I know it's not MonobjC related, I'll look around to see if
> there's a mailing list that is better suited for this kind of question.
>
> Thanks for the reply, and for looking into it!
>
> Btw, we've switched to the latest version of MonobjC, and are testing with
> your patched Mono version (which indeed fixes the SL crashes and the bundled
> machine.config)
> The application is pretty complex (compared to the other MonobjC projects
> I've seen so far) and is currently being tested.
> So far, it looks pretty good, we'll let you know if we encounter any
> problems.
>
> Keep up the good work.
>
> - Kenny
>
>
> Op 19 Dec 2009, om 11:03 heeft Laurent Etiemble het volgende geschreven:
>
> Hello,
>
> I think this is a Monobjc issue, because the name of the satellite
> assemblies is mis-generated during the assembly phase. I have already make
> some corrections to handle assembly name with space, but I have missed the
> satellite case.
>
> I will try to give it a try this week-end.
>
> Regards, Laurent Etiemble.
>
> 2009/12/18 Kenny Clement <psyki...@gmail.com>
>
>> Hi,
>>
>> I'm not too sure this belongs on the MonobjC mailing list, as this seems
>> more of a problem/shortcoming in mkbundle, but I am using the NAnt.Monobjc
>> tasks, so,
>> and I am looking for a solution for my MonobjC app, so here goes:
>>
>> One of the more standard ways of localizing Applications, is by using
>> resource files (.resx) for getting strings out of it.
>> Let's say we have an application that uses strings from Resource.resx
>> If you then copy Resource.resx to Resource.nl-BE.resx
>> and set the thread's CurrentCUlture/CurrentUICulture to nl-BE the string
>> you requested will be from the Resource.nl-BE.resx file.
>>
>> If Visual studio, or even Mono compiles this, it creates 'Satellite
>> assemblies': 1 for each language you have the resx file in.
>> I assume .NET then automagically loads these through Reflection.
>>
>> This works with Mono.
>> However, when I deploy to my customers, I don't want them to install the
>> (patched) Mono Framework, I use mkbundle.
>>
>> However, with mkBundle, it seems to be impossible to include more than 1
>> of these satellite assemblies.
>> As I need (currently) 3 languages, this is a bit of a problem.
>>
>> I've created a sample application to show the problem a little clearer.
>> It's a console application, that requests you what culture you want to
>> load, and then displays a localized string from the resource file.
>>
>> There's a nant.build file in the sample, with 3 targets:
>> clean (cleans up the ./bin and ./dist folder)
>> build (builds the app in ./bin)
>> bundle (builds the app in ./bin + uses mkbundle to create a bundle in
>> ./dist)
>>
>> nant clean build
>>  - works as expected. execute the app with
>> mono bin/ConsoleApp.exe
>>
>> nant clean bundle
>> - Does not work in the current version, gives the output you can see
>> below. To make it work, you can comment 2 lines, as described in the file,
>> but then you will only support 1 language
>>
>> Is this a bug?
>> Is this simply impossible?
>> Is there some sort of workaround available?
>>
>> Thanks in advance,
>>
>>
>>
>> - Kenny
>>
>>
>>
>> mkbundle output:
>>
>> ...........
>>  [mkbundle]   Reference added '
>> file:///Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/System.Security/2.0.0.0__b03f5f7f11d50a3a/System.Security.dll'
>>  [mkbundle]   Reference added '
>> file:///Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/Mono.Security/2.0.0.0__0738eb9f132ed756/Mono.Security.dll'
>>  [mkbundle] Getting references for additional libraries
>>  [mkbundle]   Reference added '
>> file:///Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/nl-BE/ConsoleApp.resources.dll'
>>  [mkbundle]   Reference added '
>> file:///Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/fr-FR/ConsoleApp.resources.dll'
>>  [mkbundle]   Reference added '
>> file:///Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/en-US/ConsoleApp.resources.dll'
>>  [mkbundle] Generating native sources...
>>  [mkbundle]   Embedding Assembly
>> '/Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/ConsoleApp.exe'
>>  [mkbundle]   Embedding Assembly
>> '/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/2.0/mscorlib.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/System.Security/2.0.0.0__b03f5f7f11d50a3a/System.Security.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/Mono.Security/2.0.0.0__0738eb9f132ed756/Mono.Security.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/nl-BE/ConsoleApp.resources.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/fr-FR/ConsoleApp.resources.dll'
>>  [mkbundle]   Embedding Assembly
>> '/Users/kclement/Projects/homes/kclement/code/dotnet/Localization/bin/en-US/ConsoleApp.resources.dll'
>>  [mkbundle] Source generation done in 14.67 seconds
>>  [mkbundle] Compiling native sources...
>>  [mkbundle]
>> /Users/kclement/Projects/homes/kclement/code/dotnet/Localization/dist/ConsoleApp.s:6012998:FATAL:Symbol
>> _assembly_data_ConsoleApp_resources_dll already defined.
>>  [mkbundle]
>> /Users/kclement/Projects/homes/kclement/code/dotnet/Localization/dist/ConsoleApp.c:22:
>> error: redefinition of 'assembly_bundle_ConsoleApp_resources_dll'
>>  [mkbundle]
>> /Users/kclement/Projects/homes/kclement/code/dotnet/Localization/dist/ConsoleApp.c:20:
>> error: previous definition of 'assembly_bundle_ConsoleApp_resources_dll' was
>> here
>>  [mkbundle]
>> /Users/kclement/Projects/homes/kclement/code/dotnet/Localization/dist/ConsoleApp.c:24:
>> error: redefinition of 'assembly_bundle_ConsoleApp_resources_dll'
>>  [mkbundle]
>> /Users/kclement/Projects/homes/kclement/code/dotnet/Localization/dist/ConsoleApp.c:22:
>> error: previous definition of 'assembly_bundle_ConsoleApp_resources_dll' was
>> here
>>  [mkbundle] Compilation done in 8.41 seconds
>>  [mkbundle] Collecting native libraries
>> ............
>>
>>
>>
>>
>>
>>
>
>

Reply via email to