On Thu, Jan 15, 2009 at 3:41 PM, Jb Evain <[email protected]> wrote: Then it's a bug in the Import method. Reflection gives you a > completely closed method for you to invoke it, but the Import code > should deal with that.
I'll look around to see if I can fix this but I don't have much time to learn the source right now. I want to ask another question about Import(). I'm generating assemblies based on a XML file that specifies a message format and they should be generated for two versions: regular .NET runtime and Silverlight runtime. For solving this problem I use the default resolver with an added directory to find the Silverlight mscorlib and I use Import() with the type I get from: mscorlib.Modules[0].Types[typename] I avoid to use Import() from a typeof(type) because I fear that reflection will give me the wrong reference of the type, the one which it is running at the moment and that is the regular .NET runtime. But there is sometimes when is difficult to find the type (mainly with generics) and I use typeof(type), but just after I made at least one import using the loaded Sliverlight mscorlib to get the module references right. Now I'm facing some weird exceptions like "Operation could destabilize the run-time" which I believe is some co/contravariance problem. Could this be the problem of using typeof() instead of seeking the type from the Silverlight mscorlib? If that could be the problem there is a easier way to import a generic type from another assembly definition without using typeof()? Augusto --~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~---
