RazorLight icon indicating copy to clipboard operation
RazorLight copied to clipboard

Assembly name comparison

Open Sten-V opened this issue 4 years ago • 3 comments

Is it possible that this call to Contains(...) instead should be a call to Equals(...), or is this intentional? https://github.com/toddams/RazorLight/blob/22381db30ca3c61b4b1e4004e1536407dd138e49/src/RazorLight/Compilation/DefaultMetadataReferenceManager.cs#L105

Sten-V avatar Mar 29 '21 12:03 Sten-V

excludedAssemblies is a collection, assemblyRef.Name is a string. This is intentional

toddams avatar Apr 06 '21 08:04 toddams

Yes, but the Contains(...) is not performed directly on that collection, it done on every string in that collection the way it looks now. And because it is a Contains(...) comparison between two strings it's quite possible to exclude more assemblies than the consuming code intended.

Sten-V avatar Apr 06 '21 09:04 Sten-V

Sorry, I actually overlooked the point. It's indeed weird, I'll double-check

toddams avatar Apr 07 '21 12:04 toddams