Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UsedNamespaceOrType comparing type argument incorrectly #7015

Closed
jaredpar opened this issue Nov 24, 2015 · 0 comments · Fixed by #7019
Closed

UsedNamespaceOrType comparing type argument incorrectly #7015

jaredpar opened this issue Nov 24, 2015 · 0 comments · Fixed by #7019
Assignees
Labels
Area-Compilers Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time.
Milestone

Comments

@jaredpar
Copy link
Member

Consider the contents of the Equals method

return AliasOpt == other.AliasOpt
    && TargetAssemblyOpt == other.TargetAssemblyOpt
    && TargetNamespaceOpt == other.TargetNamespaceOpt
    && TargetTypeOpt == other.TargetTypeOpt
    && TargetXmlNamespaceOpt == other.TargetXmlNamespaceOpt;

This is comparing ITypeReference values by reference instead of using their Equals method. In the case of generic types the ITypeReference values can be different objects for equivalent symbols and this comparison will incorrectly return false.

This is actually breaking determinism on compilations that have a using alias where the target type is a bound generic. It causes the result of ShouldForwardNamespaceScopes to be non-deterministic and hence changes the PDB output and content id hash.

@jaredpar jaredpar added Bug Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time. labels Nov 24, 2015
@jaredpar jaredpar self-assigned this Nov 24, 2015
@jaredpar jaredpar added this to the 1.2 milestone Nov 24, 2015
jaredpar added a commit to jaredpar/roslyn that referenced this issue Nov 26, 2015
The Equals method was using reference equality to compare ITypeReference instances.  Correct comparison of that type must use .Equals as equivalent generic values can be different objects.

This surfaced as a bug in determinism.  In the case we had an alias'd using where the target type was generic this Equals method came into play.  Based on whether we got a generic cache hit or not ended up changing the PDB output and as an effect the determinism id of the resulting assembly.

closes dotnet#7015
@gafter gafter removed the Bug label Nov 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-Determinism The issue involves our ability to support determinism in binaries and PDBs created at build time.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants