Skip to content

Conversation

@Anipik
Copy link
Contributor

@Anipik Anipik commented Jul 3, 2021

Assembly Identity rules

  • assemblies should be not null
  • names must be exactly same
  • cultures must be same
  • version of the right should be >= left (rightVersion == leftVersion under strict mode)
  • Non strict mode
    leftKeyTokenNull or retargetable flag set => always true
    else leftKeyTokenNull == rightKeyTokenNull
  • same rules for right under strict mode

added tests for each of these cases in strict and non-strict mode.

@Anipik Anipik requested review from ViktorHofer and safern July 3, 2021 03:34
@ghost
Copy link

ghost commented Jul 3, 2021

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

IEnumerable<CompatDifference> differences = differ.GetDifferences(left, right);

Assert.Single(differences);
Assert.Equal("CP0003 : left assembly name 'AssemblyA' does not match with right assembly name 'AssemblyB'.", differences.First().ToString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these tests we are not asserting the messages because they are localized. Instead do a contains: AssemblyA and COntaines `AssemblyB'.

You can look at the other tests, but there is a CompatDifferenceComparer that doesn't compare the message. In order to assert the other properties of the difference.

Also, shouldn't this diagnostic ID be CP0004?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CP0004 is thrown when mapper doesnot find the exact assembly and set one of the inputs as null

Copy link
Member

@safern safern Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A right. Should this have it's own diagnostic as well? Or you don't think it is worth it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think its worth it. I am expecting the mapper scenario to be more common and we will hit that and version, culture and token are more interesting scenrios here.

Copy link
Member

@safern safern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants