Add Copilot skill: trimmable-type-map troubleshooting
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 579
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 252
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:
1. **Architecture overview** — how `src/Microsoft.Android.Sdk.TrimmableTypeMap/` generator, `TrimmableTypeMap.cs` runtime, and `TrimmableTypeMapTypeManager.cs` fit together.
2. **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 vs `IJniNameProvider`.
- "Generated code compiles but fails at runtime" → **decompile the generated assembly** with `ilspycmd` and inspect attribute rows; don't trust the generator source.
- "Missing method on invoker" → check `GetStaticMethodFallbackTypesCore` desugar mapping.
3. **Diagnostic commands:**
- Enable `Logger.LogGlobalRef` to trace peer activation via `monodroid-peer` tag.
- Dump the generated typemap assembly: `ilspycmd obj/.../Microsoft.Android.Sdk.TrimmableTypeMap.generated.dll`.
- Inspect emitted attribute rows with `ildasm /noil`.
4. **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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.