Skip to content

Commit b02b70d

Browse files
authored
Merge branch 'release/9.0.2xx' => 'main' (#45614)
2 parents f9735a9 + 91f9c5e commit b02b70d

File tree

89 files changed

+2526
-687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2526
-687
lines changed

src/BuiltInTools/DotNetDeltaApplier/StartupHook.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void Initialize()
5959
agent.Reporter.Report("Writing capabilities: " + agent.Capabilities, AgentMessageSeverity.Verbose);
6060

6161
var initPayload = new ClientInitializationPayload(agent.Capabilities);
62-
initPayload.Write(pipeClient);
62+
await initPayload.WriteAsync(pipeClient, CancellationToken.None);
6363

6464
while (pipeClient.IsConnected)
6565
{
@@ -71,8 +71,8 @@ public static void Initialize()
7171
var logEntries = agent.GetAndClearLogEntries(update.ResponseLoggingLevel);
7272

7373
// response:
74-
pipeClient.WriteByte(UpdatePayload.ApplySuccessValue);
75-
UpdatePayload.WriteLog(pipeClient, logEntries);
74+
await pipeClient.WriteAsync((byte)UpdatePayload.ApplySuccessValue, CancellationToken.None);
75+
await UpdatePayload.WriteLogAsync(pipeClient, logEntries, CancellationToken.None);
7676
}
7777
}
7878
catch (Exception ex)

src/BuiltInTools/HotReloadAgent/AgentMessageSeverity.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
namespace Microsoft.DotNet.HotReload;
45

56
internal enum AgentMessageSeverity : byte
67
{

src/BuiltInTools/HotReloadAgent/Microsoft.DotNet.HotReload.Agent.Package.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<!-- This source package is used by Visual Studio WebTools -->
4-
<TargetFramework>$(VisualStudioServiceTargetFramework)</TargetFramework>
3+
<!--
4+
Intentionally pinned. This feature is supported in projects targeting 6.0 or newer.
5+
At the same time source build requires us to not target 6.0, so we fall back to netstandard.
6+
-->
7+
<TargetFramework>netstandard2.1</TargetFramework>
58
<GenerateDocumentationFile>false</GenerateDocumentationFile>
69
<DebugType>none</DebugType>
710
<GenerateDependencyFile>false</GenerateDependencyFile>
@@ -19,9 +22,6 @@
1922
<!-- Remove once https://github.com/NuGet/Home/issues/8583 is fixed -->
2023
<NoWarn>$(NoWarn);NU5128</NoWarn>
2124
</PropertyGroup>
22-
<ItemGroup>
23-
<FrameworkReference Include="Microsoft.AspNetCore.App" />
24-
</ItemGroup>
2525

2626
<!-- Make sure the shared source files do not require any global usings -->
2727
<ItemGroup>

src/BuiltInTools/dotnet-watch/Browser/BrowserConnector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public bool TryGetRefreshServer(ProjectGraphNode projectNode, [NotNullWhen(true)
9696
{
9797
lock (_serversGuard)
9898
{
99-
return _servers.TryGetValue(projectNode, out server);
99+
return _servers.TryGetValue(projectNode, out server) && server != null;
100100
}
101101
}
102102

src/BuiltInTools/dotnet-watch/FileItem.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ internal readonly record struct FileItem
1010

1111
/// <summary>
1212
/// List of all projects that contain this file (does not contain duplicates).
13-
/// Empty if <see cref="Change"/> is <see cref="ChangeKind.Add"/> and the
14-
/// item has not been assigned to a project yet.
13+
/// Empty if the item is added but not been assigned to a project yet.
1514
/// </summary>
1615
public required List<string> ContainingProjectPaths { get; init; }
1716

1817
public string? StaticWebAssetPath { get; init; }
1918

20-
public ChangeKind Change { get; init; }
21-
2219
public bool IsStaticFile => StaticWebAssetPath != null;
2320
}
2421
}

src/BuiltInTools/dotnet-watch/HotReload/BlazorWebAssemblyDeltaApplier.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ await browserRefreshServer.SendAndReceiveAsync(
119119
anyFailure = true;
120120
}
121121

122-
ReportLog(reporter, data.Log.Select(entry => (entry.Message, (AgentMessageSeverity)entry.Severity)));
122+
foreach (var entry in data.Log)
123+
{
124+
ReportLogEntry(reporter, entry.Message, (AgentMessageSeverity)entry.Severity);
125+
}
123126
},
124127
cancellationToken);
125128

src/BuiltInTools/dotnet-watch/HotReload/CompilationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ private async ValueTask DisplayResultsAsync(WatchHotReloadService.Updates update
364364
switch (updates.Status)
365365
{
366366
case ModuleUpdateStatus.None:
367-
_reporter.Output("No C# changes to apply.");
367+
_reporter.Report(MessageDescriptor.NoHotReloadChangesToApply);
368368
break;
369369

370370
case ModuleUpdateStatus.Ready:

src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ async Task<ImmutableArray<string>> ConnectAsync()
3636

3737
// When the client connects, the first payload it sends is the initialization payload which includes the apply capabilities.
3838

39-
var capabilities = ClientInitializationPayload.Read(_pipe).Capabilities;
39+
var capabilities = (await ClientInitializationPayload.ReadAsync(_pipe, cancellationToken)).Capabilities;
4040
Reporter.Verbose($"Capabilities: '{capabilities}'");
41-
return capabilities.Split(' ').ToImmutableArray();
41+
return [.. capabilities.Split(' ')];
4242
}
4343
catch (EndOfStreamException)
4444
{
@@ -149,7 +149,11 @@ private async Task<bool> ReceiveApplyUpdateResult(CancellationToken cancellation
149149
return false;
150150
}
151151

152-
ReportLog(Reporter, UpdatePayload.ReadLog(_pipe));
152+
await foreach (var (message, severity) in UpdatePayload.ReadLogAsync(_pipe, cancellationToken))
153+
{
154+
ReportLogEntry(Reporter, message, severity);
155+
}
156+
153157
return true;
154158
}
155159
finally

src/BuiltInTools/dotnet-watch/HotReload/DeltaApplier.cs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,21 @@ internal abstract class DeltaApplier(IReporter reporter) : IDisposable
2828

2929
public abstract void Dispose();
3030

31-
public static void ReportLog(IReporter reporter, IEnumerable<(string message, AgentMessageSeverity severity)> log)
31+
public static void ReportLogEntry(IReporter reporter, string message, AgentMessageSeverity severity)
3232
{
33-
foreach (var (message, severity) in log)
33+
switch (severity)
3434
{
35-
switch (severity)
36-
{
37-
case AgentMessageSeverity.Error:
38-
reporter.Error(message);
39-
break;
40-
41-
case AgentMessageSeverity.Warning:
42-
reporter.Warn(message, emoji: "⚠");
43-
break;
44-
45-
default:
46-
reporter.Verbose(message, emoji: "🕵️");
47-
break;
48-
}
35+
case AgentMessageSeverity.Error:
36+
reporter.Error(message);
37+
break;
38+
39+
case AgentMessageSeverity.Warning:
40+
reporter.Warn(message, emoji: "⚠");
41+
break;
42+
43+
default:
44+
reporter.Verbose(message, emoji: "🕵️");
45+
break;
4946
}
5047
}
5148
}

src/BuiltInTools/dotnet-watch/HotReload/IncrementalMSBuildWorkspace.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public async Task UpdateProjectConeAsync(string rootProjectPath, CancellationTok
4848
projectInfos = [];
4949
}
5050

51-
var oldProjectIdsByPath = oldSolution.Projects.ToDictionary(keySelector: static p => p.FilePath!, elementSelector: static p => p.Id);
51+
var oldProjectIdsByPath = oldSolution.Projects.ToDictionary(keySelector: static p => (p.FilePath!, p.Name), elementSelector: static p => p.Id);
5252

53-
// Map new project id to the corresponding old one based on file path, if it exists, and null for added projects.
53+
// Map new project id to the corresponding old one based on file path and project name (includes TFM), if it exists, and null for added projects.
5454
// Deleted projects won't be included in this map.
5555
var projectIdMap = projectInfos.ToDictionary(
5656
keySelector: static info => info.Id,
57-
elementSelector: info => oldProjectIdsByPath.TryGetValue(info.FilePath!, out var oldProjectId) ? oldProjectId : null);
57+
elementSelector: info => oldProjectIdsByPath.TryGetValue((info.FilePath!, info.Name), out var oldProjectId) ? oldProjectId : null);
5858

5959
var newSolution = oldSolution;
6060

0 commit comments

Comments
 (0)