[Mono-devel-list] Assembly Manipulation Libraries

Zoltan Varga vargaz at gmail.com
Thu Apr 28 09:51:45 EDT 2005


                                   Hi,

  The GetModules problem is now fixed in SVN, but Rail will still not run, since
it uses '\\' for creating directories, which is not portable. The
following patch
fixes that:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
diff -r orig-src/rail/RAIL/MSIL/TypeResolver.cs rail/RAIL/MSIL/TypeResolver.cs
109c109
< 			assmBldr =
AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName,access,"..\\");

---
> 			assmBldr = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName,access,"..");	

1085c1085
< }
\ No newline at end of file
---
> }

diff -r orig-src/rail/RAIL/Reflect/Assembly.cs rail/RAIL/Reflect/Assembly.cs
1305c1305
< 								if (i != (implMapRow.MemberForwarded & 0x00FFFFFF))

---
> 								if (i != ((uint)implMapRow.MemberForwarded & 0x00FFFFFF))

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

The second change is needed to work around:
http://bugzilla.ximian.com/show_bug.cgi?id=54928

          Zoltan


<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

On 4/28/05, Jim Purbrick <jimpurbrick at yahoo.co.uk> wrote:
> I'm currently looking at implementing thread migration
> by injecting stack saving and loading code in to
> methods in a similar way to the JavaGoX and
> PicoThreads systems.
> 
> I want to implement the mechanism as a bytecode
> translator so it will be able to work with any
> language that targets the CLR. I'm currently looking
> for C/C++ or C# libraries for manipulating CLR
> assemblies. If you know of any, I'd really like to
> hear about them.
> 
> The most promising library I've found so far is the
> RAIL .NET instrumentation framework
> http://rail.dei.uc.pt/ which is built on top of the
> Mono.PEToolkit and Reflection.Emit and allows high
> level OO manipulation of assemblies. I've got the
> examples working under .NET, but get errors when
> running it under Mono 1.1.4 on Windows in
> System.Reflection.Assembly:GetModulesInternal. Has
> anyone got RAIL running on Mono? Here's the full stack
> trace:
> 
> Unhandled Exception: System.NullReferenceException:
> Object reference not set to
> an instance of an object
> in (unmanaged) 004C5AC4
> in <0x00004> (wrapper managed-to-native)
> System.Reflection.Assembly:GetModulesIn
> ternal ()
> in [0x00001] (at
> C:\cygwin\download\mono-1.1.4\mcs\class\corlib\System.Reflectio
> n\Assembly.cs:582)
> System.Reflection.Assembly:GetModules (bool)
> in [0x0002e] (at
> C:\cygwin\download\mono-1.1.4\mcs\class\corlib\System.Reflectio
> n\Assembly.cs:568)
> System.Reflection.Assembly:GetModule (string)
> in <0x00051> Rail.Reflect.TypeResolver:ResolveRModule
> (Rail.Reflect.RModuleDef,s
> tring)
> in <0x00636> Rail.Reflect.RAssemblyDef:ReturnAssembly
> (string)
> in <0x00038>
> Rail.Reflect.RAssemblyDef:RunAndSaveAssembly
> (object[])
> in [0x0000d] (at
> C:\Work\RAIL\examples\RailTester.cs:340)
> AssemblyReading.RailTe
> ster:RunAndSaveAssembly ()
> in [0x00007] (at
> C:\Work\RAIL\examples\RailTester.cs:358)
> AssemblyReading.RailTe
> ster:.ctor (string)
> in [0x00003] (at
> C:\Work\RAIL\examples\RailTester.cs:363)
> AssemblyReading.RailTe
> ster:Main (string[])
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



More information about the Mono-devel-list mailing list