mikehadlow / AsmSpy

Simple command line assembly reference checker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not StrongNamed assemblies reported as error on version mismatch

pfeigl opened this issue · comments

Hi,

this time before sending any code changes I wanted to discuss the situation and get a clear view.

When an assembly is not StrongNamed and exists in another version than is requested by another assembly, the assembly is still loaded in .NET.
assemblyBindings do not apply, as this is only available for strong named assemblies.

So, while a project might actually have problems running (because of incompatible version combinations), from a assembly loading perspective, everything is "fine".

End of last year there was the following commit: f60398a

While the main intention of the commit was to introduce a ConsoleTreeVisualizer it also contains changes for AlternativeFoundVersion. These alternative versions are actually reported as warnings while the assemblies are "searched". However later on in the process, the normal ConsoleVisualizer doesn't care about those version mismatches and just reports a missing assembly.

So long story short: I think, AsmSpy should actually only report warnings for version mismatches (if we are not talking StrongNamed assemblies).
However this would be kind of a breaking change to the current implementation?

My recommandations would be:

  • Stick to how .NET actually loads assemblies and therefor do not error out on those version mismatches
  • Make sure that all visualizers follow a similar implementation (Console vs ConsoleTree)
  • Optional: If need be, add a small switch to toggle how version mismatches for non StrongNamed assemblies are handled

Regards,
Philipp

Hi Philipp,

Thanks for such a thoroughly thought out issue. And sorry it's taken me a while to get back to you. I agree with your points, I think all the visualisers should be consistent, and it's just a legacy issue that they aren't. So yes to your first two recommendations. I can't really see the benefit of the switch, it would just add complexity and confusion.

If you are thinking of submitting a PR with these changes I'd be very happy. Otherwise I will try to take some time to do some refactoring, but I can't make any promises of when that will happen.

Thanks again!
Mike