Repository navigation
Discover type maps from the group defining assembly - #136606
Draft
jkoritzinsky wants to merge 1 commit into
Draft
jkoritzinsky wants to merge 1 commit into
jkoritzinsky wants to merge 1 commit into
Conversation
Lazily discover group-specific mappings and assembly targets from reachable requests in CoreCLR, NativeAOT, and ILLink. Preserve entry-root contributions, trimming conditions, and duplicate detection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
jkoritzinsky
requested review from
AaronRobinsonMSFT,
MichalStrehovsky and
jtschuster
October 28, 2026 21:46
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I wanted to see if we could enable discovering type maps from the assembly that defines the group type to enable more cohesive usage for scenarios without app-wide analysis (like npgsql). Seems relatively clean, so I'm putting it up for review.
Approach
Regression coverage includes transitive targets, cycles and overlapping roots, entry overrides, generic and array groups, unused groups, empty maps, conditional retention, and genuine duplicate keys. Newly discovered entries can expose duplicate keys that were previously ignored; existing duplicate-key rejection remains intentional.
Validation
Windows x64 validation passed:
./build.cmd clr+libs+host -rc checked -lc release- clean baseline passed../build.cmd clr.runtime+clr.tools -rc checked -lc release- changed VM, NativeAOT compiler, and Crossgen2 build passed../src/tests/build.cmd generatelayoutonly x64 checked- passed../src/tests/build.cmd test Interop\TypeMap\TypeMapDefiningAssemblyApp.csproj test Interop\TypeMap\TypeMapEntryAssemblyApp.csproj test Interop\TypeMap\TypeMapApp.csproj x64 checked skipnative- passed; all three generated wrappers passed withDOTNET_ReadyToRun=0.crossgen2- passed; all three wrappers passed withRunCrossGen2=1and the repository SDK selected for R2RDump.nativeaot- passed; all three native executables exited 100. Four existing IL3000 warnings concernAssembly.Locationin R2R-only checks../dotnet.cmd test src\tools\illink\test\Mono.Linker.Tests\Mono.Linker.Tests.csproj -c Debug --filter FullyQualifiedName~Mono.Linker.Tests.TestCases.Reflection.ReflectionTests- 55 passed../dotnet.cmd test src\coreclr\tools\aot\ILCompiler.Trimming.Tests\ILCompiler.Trimming.Tests.csproj -c Checked --filter DisplayName~TypeMap -p:RuntimeConfiguration=Checked -p:LibrariesConfiguration=Release- 4 passed.The defining-assembly regression failed before the fix in CoreCLR, NativeAOT, and ILLink. Linux and other architectures were not run.
Discovery cost
Release BenchmarkDotNet measurements on a Windows x64 VM, using identical map contents in both hosts:
Same-assembly discovery is deduplicated. Scanning CoreLib as an additional root adds about 4.4 us per creation in this measurement; this measures map creation, not dictionary lookup. Results are from a single Windows x64 VM, not cross-platform performance evidence.
Resolves #136575
Note
This pull request description and implementation were generated with GitHub Copilot.