Silverlight port

Dec 13, 2009 at 2:58 AM

Hi

I tried to port your code to SL, everyting went fine 99% of the code compiled without any problems. Well I had to add some classes to SL that were missing in SL, such ArrayList, SerializationInfo, I took them from mscorlib, 
the only major change I had to is this

#if !SILVERLIGHT
            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                assemblyName,
                AssemblyBuilderAccess.RunAndSave
                );

            moduleBuilder = assemblyBuilder.DefineDynamicModule(
                assemblyName.Name,
                assemblyName.Name + ".dll",
                true);
#else
            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                  assemblyName,
                  AssemblyBuilderAccess.Run
                  );
            moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, true);
#endif

works ok though. Now when I try to run tests from GeneralTests class I get such an exception for this line
ObjectsMapperBaseImpl result =
                (ObjectsMapperBaseImpl)Activator.CreateInstance(typeBuilder.CreateType());
the exception is
Method 'CreateTargetInstance' on type 'ObjectsMapper1_SL.Test.GeneralTests+Simple2_SL.Test.GeneralTests+Simple10b6064c1714144b9a905f934a237ced9b' 
from assembly 'EmitMapperAssembly.SL, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is overriding a method that is not visible from that assembly.
maybe you have some ideas how to solver this. If this is solved the port to SL might be considered done :)
I can send the full solution if you want.
Thx

 

Coordinator
Dec 15, 2009 at 8:34 PM

Eugen, thanks a lot for porting the library to SL!

To solve the issue you described below add the folowing line to AssemblyInfo.cs

[assembly: InternalsVisibleTo("EmitMapperAssembly")]

So, I'm very interesting whether SL port will work :)

Dec 15, 2009 at 8:44 PM

Hi

After this the simple tests worked fine.
It failed on General_Test1 with some weird message, like "This operation could crash the run-time" :)

Here is the full solution if you want to take it from here http://designleon.com/temp/EmitMapper.zip

Let me know of your investigation.

Coordinator
Dec 18, 2009 at 4:24 PM

Hi,

Many thanks!

So, I'have made some changes and managed to run the library on Silverlight and it passed all tests (from your port). The changes are in the SVN. Actually 2 files were changed:

  1. EmitMapper\EmitBuilders\MappingOperationsProcessor.cs
  2. EmitMapper\EmitInvoker\Delegates\DelegateInvoker.cs

Just replace them with the latest from SVN and tests will pass.

 

 

Dec 18, 2009 at 5:29 PM

that's good to hear, I added some more tests and seems to work good. you can declare an official SL release :)

Coordinator
Dec 21, 2009 at 12:58 PM

I fixed few SL-specific bugs in addidion and now all unit tests are passed on sliverlight. So, Silverlight port is available now in the main trunk in SVN.

Dec 21, 2009 at 5:51 PM

great news. Now library can be considered complete. :)