Hi!

I'm writing a program which compares two assemblies, telling how their
public APIs differ (the assemblies are two different implementations
of the same thing so comparisons do make sense there). It basically
looks through all types and collects all TypeDefintions,
MethodDefinitions, PropertyDefinitions and FieldDefinitions as
objects. For comparison it executes the following lines (shortened):

assemblies[0].Except(assemblies[1]);
assemblies[1].Except(assemblies[0]);

Except() is the Enumberable extension method. But my test shows that
even things which are identical appear in both lists. Looking at the
definition classes, I see they don't have the Equals method. So Except
() uses reference comparisons. I guess even if Cecil uses singletons
for each definition, different assemblies won't create reference-
identical objects even for structural identical objects.

So does the SVN-cecil include equals-methods or do I have to roll my
own Comparer method?

Other things I noticed during implementation:

The collection types don't have generic enumerators. That prevents
using var in foreach loops.

The variant definition classes lack a super class, over which I could
do my checks without worrying about the actual type.

I haven't included events in my checks because I don't see a way how
to check their accessibility.

The check IsFamily doesn't seem to return true if IsFamilyOrAssembly
or IsFamilyAndAssembly are true (IsAssembly has the same problem).
Checking for protected access requires to look for the single and at
least one of the combined attributes. That is somewhat inconvenient.

Best regards
Johannes

-- 
--
mono-cecil

Reply via email to