Yes i figured that's an ugly hack. I will follow your tips to do it properly.
On Thu, Nov 27, 2014 at 11:08 AM, Jb Evain <[email protected]> wrote: > Yeah it doesn't :) > > Two obvious cases: > > 1) type will the same full name can be defined in multiple assemblies. > 2) the name of generic parameter doesn't cross assemblies boundaries, > so if you work on the defining assembly you can see an instantiation > of Dictionary<TKey, TValue>, but in another assembly you'll see a > Dictionary<!0, !1> for instance. > > And probably more I forgot right now. > > Jb > > > On Thu, Nov 27, 2014 at 10:03 AM, Lior Tal <[email protected]> wrote: > > Thanks i will look into that. > > > > As a hack for now i compare the ToString() of both types as it seems to > > return the same method signature :) not sure whether that holds for all > > cases... > > > > On Thu, Nov 27, 2014 at 10:59 AM, Jb Evain <[email protected]> wrote: > >> > >> Hey, > >> > >> Comparing metadata for equality is pretty hard, as not everyone has > >> the same definition (there's a pretty good thread on this group about > >> it). > >> > >> The way I usually implement it is as follow: > >> > >> * I maintain a shared assembly resolver to make sure that assemblies > >> are never loaded twice. > >> * This way when you encounter a MethodReference, you can Resolve it. > >> * Then you can compare the MethodDefinition by reference equality. > >> * For generic instances, you will need to still compare the resolved > >> MethodDefinition by reference, and on top of that compare the > >> instantiation. You can do the same trick to compare resolved types by > >> identity. > >> > >> Jb > >> > >> On Wed, Nov 26, 2014 at 10:41 PM, Lior Tal <[email protected]> wrote: > >> > Hey, > >> > > >> > I have a MethodReference that i'd like to search for in other > >> > assemblies. > >> > > >> > I am iterating over all types, methods with bodies and instructions to > >> > find > >> > the MethodReference usage as the instruction's operand. > >> > > >> > How do i compare it with the original MethodReference instance that i > >> > already have, to see that they match ? > >> > > >> > Reference equality does not work obviously, what is the proper way of > >> > doing > >> > that ? > >> > > >> > --Lior > >> > > >> > -- > >> > -- > >> > -- > >> > 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. > > > > > > -- > > -- > > -- > > 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. > -- -- -- 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.
