Skip to content

Commit 96fa04a

Browse files
authored
Include projects to restart/rebuild in ManagedHotReloadUpdates (#75918)
1 parent 5601472 commit 96fa04a

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,13 @@ public async ValueTask<ManagedHotReloadUpdates> GetUpdatesAsync(ImmutableArray<s
400400

401401
UpdateApplyChangesDiagnostics(result.Diagnostics);
402402

403-
return new ManagedHotReloadUpdates(result.ModuleUpdates.Updates.FromContract(), result.GetAllDiagnostics().FromContract());
403+
return new ManagedHotReloadUpdates(
404+
result.ModuleUpdates.Updates.FromContract(),
405+
result.GetAllDiagnostics().FromContract(),
406+
GetProjectPaths(result.ProjectsToRebuild),
407+
GetProjectPaths(result.ProjectsToRestart));
408+
409+
ImmutableArray<string> GetProjectPaths(ImmutableArray<ProjectId> ids)
410+
=> ids.SelectAsArray(static (id, solution) => solution.GetRequiredProject(id).FilePath!, solution);
404411
}
405412
}

src/EditorFeatures/ExternalAccess/Debugger/GlassTestsHotReloadService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void EndDebuggingSession()
8585
public async ValueTask<ManagedHotReloadUpdates> GetUpdatesAsync(Solution solution, CancellationToken cancellationToken)
8686
{
8787
var results = (await _encService.EmitSolutionUpdateAsync(GetSessionId(), solution, runningProjects: [], s_noActiveStatementSpanProvider, cancellationToken).ConfigureAwait(false)).Dehydrate();
88-
return new ManagedHotReloadUpdates(results.ModuleUpdates.Updates.FromContract(), results.GetAllDiagnostics().FromContract());
88+
return new ManagedHotReloadUpdates(results.ModuleUpdates.Updates.FromContract(), results.GetAllDiagnostics().FromContract(), [], []);
8989
}
9090
}
9191
}

src/Features/TestUtilities/EditAndContinue/EditAndContinueWorkspaceTestBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public abstract class EditAndContinueWorkspaceTestBase : TestBase, IDisposable
5454
/// <summary>
5555
/// Streams that are verified to be disposed at the end of the debug session (by default).
5656
/// </summary>
57-
public List<(Guid mvid, Stream stream)> DisposalVerifiedStreams = [];
57+
private ImmutableList<Stream> _disposalVerifiedStreams = [];
5858

5959
public override void Dispose()
6060
{
6161
base.Dispose();
6262

63-
foreach (var (_, stream) in DisposalVerifiedStreams)
63+
foreach (var stream in _disposalVerifiedStreams)
6464
{
6565
Assert.False(stream.CanRead);
6666
}
@@ -314,15 +314,15 @@ internal Guid EmitLibrary(Compilation compilation, DebugInformationFormat pdbFor
314314
OpenAssemblyStreamImpl = () =>
315315
{
316316
var stream = new MemoryStream();
317-
DisposalVerifiedStreams.Add((moduleId, stream));
317+
ImmutableInterlocked.Update(ref _disposalVerifiedStreams, s => s.Add(stream));
318318
peImage.WriteToStream(stream);
319319
stream.Position = 0;
320320
return stream;
321321
},
322322
OpenPdbStreamImpl = () =>
323323
{
324324
var stream = new MemoryStream();
325-
DisposalVerifiedStreams.Add((moduleId, stream));
325+
ImmutableInterlocked.Update(ref _disposalVerifiedStreams, s => s.Add(stream));
326326
pdbImage.WriteToStream(stream);
327327
stream.Position = 0;
328328
return stream;

0 commit comments

Comments
 (0)