Skip to content

Conversation

@ryalanms
Copy link
Member

@ryalanms ryalanms commented Feb 19, 2021

Description

Use reflection-only context for InternalsVisibleToAttribute type comparison.

Fixes Issue #2492: Compilation error MC3064 when importing internal user control from signed class library. The wrong load context was used for a type comparison that always failed.

Customer Impact

Internal types contained in assemblies with InternalsVisibleTo attributes that are referenced in markup cause a markup compiler error: error MC3064: Only public or internal classes can be used within markup. 'InternalClass' type is not public or internal.

Regression

This is a regression from .NET Framework.

Testing

Repro'd the issue and tested the fix against .NET Core targeting .NET Framework 4.72/4.8 + .NET Core 3.1/6.0 and .NET Framework targeting .NET Framework 4.72/4.8 + .NET Core 3.1/6.0. Referencing internal types in markup that are contained in an assembly with InternalsVisibleTo (which grants access to the target assembly) now works as expected.

@ryalanms ryalanms requested a review from a team as a code owner February 19, 2021 00:31
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Feb 19, 2021
@ghost ghost requested review from SamBent and fabiant3 February 19, 2021 00:31
@ryalanms
Copy link
Member Author

Thanks, @fabiant3.

@ryalanms ryalanms merged commit a51ea08 into master Feb 22, 2021
@vishalmsft vishalmsft deleted the markup.referencing.internalsvisibleto branch February 10, 2022 06:03
@ghost ghost locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants