Repository navigation
Description
Problem
The trimmable typemap is a complex subsystem spanning a source generator (src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/), generated runtime proxies, a managed TrimmableTypeMap lookup, and integration with the Java peer value manager. When things go wrong at runtime (crashes, NotSupportedException, peer activation failures), the debugging path is non-obvious.
During PR #11091, the root cause of many hours of investigation was a single missing self-application attribute on generated JavaPeerProxy-derived types — a bug that was hidden because we trusted the generator's source code rather than inspecting the produced IL.
Proposal
Add .github/skills/trimmable-typemap/SKILL.md containing:
-
Architecture overview — how
src/Microsoft.Android.Sdk.TrimmableTypeMap/generator,TrimmableTypeMap.csruntime, andTrimmableTypeMapTypeManager.csfit together. -
Troubleshooting recipes for common symptoms:
- "
NotSupportedException: No generated JavaPeerProxy was found…" → check generator output for missing proxy type or missing[JavaPeerProxy]self-application. - "Wrong target type returned for a Java class" → check
[Register]attribute precedence vsIJniNameProvider. - "Generated code compiles but fails at runtime" → decompile the generated assembly with
ilspycmdand inspect attribute rows; don't trust the generator source. - "Missing method on invoker" → check
GetStaticMethodFallbackTypesCoredesugar mapping.
- "
-
Diagnostic commands:
- Enable
Logger.LogGlobalRefto trace peer activation viamonodroid-peertag. - Dump the generated typemap assembly:
ilspycmd obj/.../Microsoft.Android.Sdk.TrimmableTypeMap.generated.dll. - Inspect emitted attribute rows with
ildasm /noil.
- Enable
-
Known testing gaps — cross-reference with issue about generator unit tests.
Acceptance criteria
- Skill exists with proper frontmatter.
- Triggered by phrases like "trimmable typemap", "JavaPeerProxy", "NotSupportedException typemap".
- Contains the decompile-generated-dll recipe.
- References the relevant source files and test projects.
Discovered during
PR #11091 — adding the CoreCLRTrimmable CI lane. Root cause was a missing attribute in generator output.
Activity