Repository navigation
Commit caf6b2a
[browser][trimmed] Fix DI generic constraint tests conflicting with trimmability validation (dotnet#134760)
**Cause:** When `PublishTrimmed` is set,
`src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets`
defaults `VerifyDependencyInjectionOpenGenericServiceTrimmability` to
`true`, which enables the
`Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability`
feature switch. `CallSiteFactory.ValidateTrimmingAnnotations` then
rejects the open-generic registrations that these `CallSiteFactoryTest`
cases deliberately use (implementation constraints the service type
lacks), so container construction throws `ArgumentException`. This is
intended validation, not missing metadata.
**Fix:** The DI test project opts out of the default, and the five
`ActiveIssue` attributes are removed. The only test that needs the
switch on, `VerifyOpenGenericTrimmabilityChecks`, sets it explicitly
through RemoteExecutor `RuntimeConfigurationOptions`, so its coverage is
unchanged. It's also skipped wherever RemoteExecutor is unsupported,
including browser.
**Validation:** browser-wasm CoreCLR Release,
`Microsoft.Extensions.DependencyInjection.Tests` with
`EnableAggressiveTrimming=true TestTrimming=true` on Chrome: 884 tests,
847 passed, 37 skipped, 0 failed. All 7 re-enabled cases (4 facts + 3
theory rows) passed, and the published `runtimeconfig.json` shows the
switch as `false`. The issue reports the same failure on Mono browser
trimming; only CoreCLR was run locally.
Resolves dotnet#134266
> [!NOTE]
> This PR was generated with GitHub Copilot assistance.
Co-authored-by: Copilot App <[email protected]>1 parent 3c7c356 commit caf6b2a
2 files changed
Lines changed: 3 additions & 5 deletions
File tree
- src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests
- ServiceLookup
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | 274 | | |
276 | 275 | | |
277 | 276 | | |
| |||
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
289 | | - | |
290 | 288 | | |
291 | 289 | | |
292 | 290 | | |
| |||
331 | 329 | | |
332 | 330 | | |
333 | 331 | | |
334 | | - | |
335 | 332 | | |
336 | 333 | | |
337 | 334 | | |
| |||
346 | 343 | | |
347 | 344 | | |
348 | 345 | | |
349 | | - | |
350 | 346 | | |
351 | 347 | | |
352 | 348 | | |
| |||
532 | 528 | | |
533 | 529 | | |
534 | 530 | | |
535 | | - | |
536 | 531 | | |
537 | 532 | | |
538 | 533 | | |
| |||
0 commit comments