Skip to content

[HotReload] Move the emit to Roslyn's ExternalAccess.HotReload.HotReloadService once it ships #25506

Open

Description

@kazo0

What would you like to be added? 💡

Move the DevServer's hot-reload emit from reflection over Roslyn internals to Roslyn's supported API, Microsoft.CodeAnalysis.ExternalAccess.HotReload.HotReloadService, once that assembly ships in a released package.

Today Uno.HotReload (WatchHotReloadService) creates Roslyn's internal ExternalAccess.UnitTesting.Api.UnitTestingHotReloadService. Since #24085 it no longer calls that wrapper's emit, because the wrapper commits the Edit-and-Continue baseline whenever the status is Ready, and Roslyn 5.x answers Ready for a rejected rude edit too (#25378). Instead it reflects into the wrapper's private _encService / _sessionId fields and drives the engine directly (EmitSolutionUpdateAsync, CommitSolutionUpdate, DiscardSolutionUpdate, and the members of EmitSolutionUpdateResults).

ExternalAccess.HotReload.HotReloadService is the API built for this. It returns the updates together with the projects to rebuild/restart, and leaves commit/discard to the caller, which is the contract #24085 rebuilds by hand.

Why is this needed? 🤔

The reflection depends on about 20 private Roslyn members. A Roslyn bump that renames or reshapes any of them makes every hot-reload session fail at startup. The failure is explicit, naming the member, but hot reload is down until the shim is patched. A supported API removes that risk and the reflection code (WatchHotReloadService.Emit.cs).

Where the assembly stands today (checked 2026-10-14):

  • nuget.org: not published (Microsoft.CodeAnalysis.ExternalAccess.HotReload returns 404).
  • dnceng dotnet-tools feed: prerelease builds only (5.13.0-1.*).
  • .NET SDK: bundled privately inside dotnet-watch (sdk/10.0.400/DotnetTools/dotnet-watch/.../Microsoft.CodeAnalysis.ExternalAccess.HotReload.dll).
  • Microsoft.CodeAnalysis.Features 5.6.0, the line the DevServer embeds, grants it InternalsVisibleTo but does not contain it.

For which platforms 📱💻🖥️

All platforms 🌍

Anything else we need to know? 💬

  • Trigger: a stable Microsoft.CodeAnalysis.ExternalAccess.HotReload on nuget.org, at a version compatible with the Roslyn line pinned in src/Uno.DevServer.Roslyn.props.
  • The migration should keep the commit policy from fix(hr): never commit an EnC baseline for an update that was not applied #24085: commit only when deltas are handed out, and discard otherwise. Ideally the commit moves after the deltas are applied (today it happens before IHotReloadHandler.OnHotReloadAsync).
  • HotReloadEmitResult (internal) already carries what that API returns, so consumers of IWatchHotReloadService should not need to change.

Activity

  1. added
    kind/enhancement
    triage/untriaged
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementtriage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions