Skip to content

Reference System.Net.ServerSentEvents only on net8.0/net9.0 - #9941

Merged
glen-84 merged 1 commit into
mainfrom
gai/serversentevents-net10-pruning
Jun 17, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/serversentevents-net10-pruning

Conversation

@glen-84

@glen-84 glen-84 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • System.Net.ServerSentEvents (the SseParser API) was introduced as a standalone package in .NET 9 but is in-box in the net10.0 shared framework. Referencing it unconditionally tripped NU1510 ("will not be pruned … likely unnecessary"), which broke the Nitro CLI AOT publish in the Release workflow — that path forces a single-targeted net10.0 restore (-p:TargetFrameworks=net10.0) under TreatWarningsAsErrors.
  • PR CI never caught it: it restores multi-TFM (net8.0;net9.0;net10.0), where the package is genuinely required for the lower TFMs, so NU1510 is not emitted; and it doesn't build the Nitro CLI binary at all.
  • Gate the package reference to net8.0/net9.0 in both consumers (Transport.Http, Fusion.Execution); on net10.0 the in-box type is used.

Test plan

  • Single-TFM net10.0 build of both projects now succeeds — no NU1510, and compiles against the in-box type.
  • net8.0/net9.0 builds still resolve and use the package.
  • Per-TFM restore matrix clean for both projects across net8.0, net9.0, and net10.0 (previously net10.0 → NU1510).

Copilot AI review requested due to automatic review settings June 17, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a restore/AOT publish failure by only referencing System.Net.ServerSentEvents when targeting frameworks that need the standalone package (net8.0/net9.0), avoiding NU1510 on net10.0 where the API is in-box.

Changes:

  • Gate System.Net.ServerSentEvents PackageReference to net8.0 and net9.0 in Fusion.Execution.
  • Gate System.Net.ServerSentEvents PackageReference to net8.0 and net9.0 in Transport.Http.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/HotChocolate/Fusion/src/Fusion.Execution/HotChocolate.Fusion.Execution.csproj Adds TFM-conditional package reference so net10.0 avoids NU1510 while net8.0/net9.0 still restore the package.
src/HotChocolate/AspNetCore/src/Transport.Http/HotChocolate.Transport.Http.csproj Same TFM-conditional package reference to keep SSE support on net8.0/net9.0 without pulling the package on net10.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the gai/serversentevents... branch remains at 49%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 4691dfa gai/serversentevents... d6628c8 +/-
/home/runner/wo...tDiagnostics.cs 88% 73% -15%
/home/runner/wo...entsListener.cs 66% 62% -4%
/home/runner/wo...gerMessage.g.cs 19% 15% -4%
/home/runner/wo...PromiseCache.cs 81% 78% -3%
/home/runner/wo...geDispatcher.cs 77% 75% -2%
/home/runner/wo...DefaultTopic.cs 90% 89% -1%
/home/runner/wo...qlConnection.cs 89% 92% +3%
/home/runner/wo...gerMessage.g.cs 6% 10% +4%
/home/runner/wo...eiveEndpoint.cs 72% 77% +5%
/home/runner/wo...gerMessage.g.cs 15% 27% +12%

Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@glen-84
glen-84 merged commit 3e4fb5c into main Jun 17, 2026
145 checks passed
@glen-84
glen-84 deleted the gai/serversentevents-net10-pruning branch June 17, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants