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

Use reflection or a compile-time only shim assembly to reference unexposed corelib types. #61802

Merged
merged 8 commits into from
Nov 20, 2021

Conversation

jkoritzinsky
Copy link
Member

Use reflection for the hosting tests as they'll be around indefinitely.

Use the ref-assembly trick for ICastable testing since ICastable testing would require Ref-emit which makes the test significantly less readable and since ICastable will be going away within the .NET 7 timeframe. Supercedes #61754

…posed corelib types.

Use reflection for the hosting tests as they'll be around indefinitely.

Use the ref-assembly trick for ICastable testing since ICastable testing would require Ref-emit which makes the test significantly less readable and since ICastable will be going away within the .NET 7 timeframe. Supercedes dotnet#61754
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
ICastable.CoreLib provides a "shim" definition of ICastable in System.Private.CoreLib for the Castable test suite.
Copy link
Member

Choose a reason for hiding this comment

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

Neat hack :-)

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

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

This is works too.

My opinion here is that this sort of code is much harder to work with and is far more annoying to use than simply having a pseudo ref assembly. The shim/proxy type approach works but it does make things much harder to debug in managed code.

Thanks for removing the SPCL ref logic, that is a win either way.

@jkoritzinsky
Copy link
Member Author

Looks like things break really badly if CoreLib has any types marked with [TypeIdentifierAttribute]. I'll rewrite the Activator test to do something else to still be able to test things.

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
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