Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Detect cases when type system objects from multiple contexts are used… - #1097

Merged
davidwrighton merged 1 commit into
dotnet:masterfrom
davidwrighton:detect_context_contamination
Apr 7, 2016
Merged

davidwrighton merged 1 commit into
dotnet:masterfrom
davidwrighton:detect_context_contamination

Conversation

@davidwrighton

Copy link
Copy Markdown
Member

… in combination. This is done via asserts around comparison operators which should be sufficient.

… in combination. This is done via asserts around comparison operators which should be sufficient.
}

#if DEBUG
public static bool operator ==(TypeDesc left, TypeDesc right)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would there be value in adding operator== and operator!= to FieldDesc and MethodDesc?

If you do that, you should be able to just use the operator in MetadataVirtualMethodAlgorithm.cs and get rid of the assert. Plus we get extra protection everywhere else we compare Field/MethodDesc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well, this is just a set of asserts that should make this problematic case pretty easy to detect... I'll happily add the operators if you'd prefer.

@davidwrighton

Copy link
Copy Markdown
Member Author

@MichalStrehovsky PTAL

@MichalStrehovsky

Copy link
Copy Markdown
Member

LGTM

@davidwrighton
davidwrighton merged commit af5d92a into dotnet:master Apr 7, 2016
@davidwrighton
davidwrighton deleted the detect_context_contamination branch May 10, 2017 22:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants