Repository navigation
Conversation
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The registered SSR runtime implementation is not aligned with the new interface annotation contract and can produce IL2046 warnings.
Review effort: Balanced
Findings: 1
What changed in this PR
Aligns trimming diagnostics across synchronous and asynchronous JS interop serialization APIs.
Changes:
- Adds consistent
RequiresUnreferencedCodeannotations. - Replaces unsafe void-call suppressions while narrowly suppressing disposal.
- Adds reflection-based annotation regression tests.
| File | Description |
|---|---|
src/Components/JSInterop/test/JSInteropTrimmingAnnotationsTest.cs |
Verifies annotation counts, messages, and generic-member preservation. |
src/Components/JSInterop/src/JSRuntimeExtensions.cs |
Annotates asynchronous runtime extensions. |
src/Components/JSInterop/src/JSRuntime.cs |
Annotates runtime serialization methods. |
src/Components/JSInterop/src/JSObjectReferenceExtensions.cs |
Annotates object-reference extensions. |
src/Components/JSInterop/src/JSInProcessRuntimeExtensions.cs |
Replaces the void-call suppression with a warning. |
src/Components/JSInterop/src/JSInProcessObjectReferenceExtensions.cs |
Replaces the object-reference void-call suppression. |
src/Components/JSInterop/src/Implementation/JSObjectReference.cs |
Annotates implementations and narrowly suppresses disposal. |
src/Components/JSInterop/src/IJSRuntime.cs |
Updates the runtime interface contract. |
src/Components/JSInterop/src/IJSObjectReference.cs |
Updates the object-reference interface contract. |
| /// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>window.someScope.someFunction</c>.</param> | ||
| /// <param name="args">JSON-serializable arguments.</param> | ||
| /// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns> | ||
| [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")] |
|
@copilot Please address the CCR review comment and all PR-caused CI failures on head 31839bd. CCR review 5434470410, posted 2026-10-06T20:55:21Z, has one inline comment:
CI failures attributable to this PR:
IL2026 sites include The PR build uses merge commit Final check conclusions on this head: 25 FAILURE (the pipeline/job checks above, Build Analysis, and Build Insights), 4 SUCCESS (Code check, CLA, and both Helix Queue Insights checks), and 1 NEUTRAL (always-green). Build Analysis and Build Insights are aggregate failures, not additional independent product failures. Unrelated failures: the superseded Windows Server attempt-1 log 150 and template attempt-1 log 14 were matched to dotnet/dnceng#5922, "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." This is a transport/infrastructure failure, not caused by the annotation changes; no code change is requested for that failure. It does not explain the authoritative attempts' IL2026/IL2046 errors. Markdownlint is |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Implemented in ed1a296. |
| return new(null, callback); | ||
| } | ||
|
|
||
| [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "The callback value type is defined by the component's EventCallback<T> parameter and preserved by the component parameter contract.")] |
There was a problem hiding this comment.
Added RequiresUnreferencedCode to all four public RegisterForJavaScript overloads and changed the callback suppression to rely on that consumer-visible registration warning, not component parameter preservation. A regression test verifies the annotations. Commit: 70f27004.
|
@copilot Please address the CCR review comment and all PR-caused CI failures on head ed1a296. CCR review 5443916440, posted 2026-10-07T14:34:29Z, has one new inline comment:
PR-caused CI build errors on this head include:
Other errors name Affected sites include The PR merge source is Final CI results (all attempt 1):
Final conclusions: 24 FAILURE (the listed pipeline/job checks plus Build Analysis/Build Insights), 5 SUCCESS (managed source-build, Code check, CLA, both Helix Queue Insights), 1 NEUTRAL (always-green). Build Analysis/Build Insights are aggregate failures, not separate product errors. No unrelated failure was established in these final attempt-1 logs. Markdownlint remains |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Committed as |


Align JS interop trimming warnings across synchronous and asynchronous APIs
Apply consistent trimming warnings to JS interop serialization APIs.
Description
Synchronous JS interop APIs carry
RequiresUnreferencedCode, while corresponding async APIs omit it.DynamicallyAccessedMembersdoes not cover nested object graphs or arbitrary serialized arguments, so both annotations remain necessary.Runtime behavior and method signatures are unchanged.