Add DynamicallyAccessedMembers attributes to variance test helpers#121734
Merged
MichalStrehovsky merged 3 commits intoMichalStrehovsky-patch-1from Nov 18, 2025
Merged
Add DynamicallyAccessedMembers attributes to variance test helpers#121734MichalStrehovsky merged 3 commits intoMichalStrehovsky-patch-1from
MichalStrehovsky merged 3 commits intoMichalStrehovsky-patch-1from
Conversation
Co-authored-by: MichalStrehovsky <[email protected]>
Copilot
AI
changed the title
[WIP] Build the test tree with TrimMode set to full
Add DynamicallyAccessedMembers attributes to variance test helpers
Nov 18, 2025
Member
|
@copilot do the same thing transitively for all generic callsites. For example, method |
Co-authored-by: MichalStrehovsky <[email protected]>
Contributor
Author
I've added the
All 6 test files updated. Commit: 63c99f4 |
b24ee67
into
MichalStrehovsky-patch-1
13 of 17 checks passed
MichalStrehovsky
pushed a commit
to MichalStrehovsky/runtime
that referenced
this pull request
Nov 21, 2025
MichalStrehovsky
pushed a commit
that referenced
this pull request
Nov 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trimming with
TrimMode=fullwas removing default constructors used byActivator.CreateInstancein variance tests, causing test failures insrc/tests/Loader/classloader/generics/Variance/IL.Changes
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]to theUtype parameter in the following methods across 6 test files (Unbox001-006.cs):UnboxUToTInternal<T,U>()CaseClassUToTWrapper<T,U>()UnboxUToT<T,U>()using System.Diagnostics.CodeAnalysis;directiveThis preserves the parameterless constructors required by the generic variance tests when building with trimming enabled by ensuring the attribute is present at every level of the generic method call chain.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.