The best way to achieve this is to control the assembly resolver that is used across all your assemblies.
You can achieve that by using the overload of ReadModule/ReadAssembly that takes a ReaderParameter, and pass one resolver to it. Same for resolving, in your case, use the Resolve overload that takes a ReaderParameter, create one and set its AssemblyResolver to your unique resolver. This way you'll be able to compare TypeDefinition instances by identity. Jb On Tue, Nov 7, 2017 at 3:32 AM, Marko Grdinic <[email protected]> wrote: > open Mono.Cecil > > let resolver = new DefaultAssemblyResolver() > let assembly_load fullname = resolver.Resolve(AssemblyNameReference.Parse( > fullname)).MainModule > let mscorlib = assembly_load "mscorlib" > let fsharp_core = assembly_load "FSharp.Core, Version=4.4.0.0, > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" > > let bool = mscorlib.GetType("System.Boolean") > let ops = fsharp_core.GetType("Microsoft.FSharp.Core.Operators") > let isNull = > ops.Methods > |> Seq.find (fun x -> x.Name = "IsNull") > > isNull.ReturnType.Resolve() = bool // false > // Is there any way to make this resolve to the same type? > > --- > > Since I am using TypeDefinitions in dictionaries, I need the equality to > be firm. The above is the final hurdle before I can finish the rewrite and > make the interop module work with Mono.Cecil. > > -- > -- > -- > mono-cecil > --- > You received this message because you are subscribed to the Google Groups > "mono-cecil" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- -- mono-cecil --- You received this message because you are subscribed to the Google Groups "mono-cecil" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
