Skip to content

Commit 89c4d63

Browse files
authored
[automated] Merge branch 'release/10.0.2xx' => 'main' (#51619)
2 parents 2b9fc02 + 2184797 commit 89c4d63

File tree

151 files changed

+3300
-3055
lines changed

Some content is hidden

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

151 files changed

+3300
-3055
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,11 @@ dotnet_diagnostic.IDE0040.severity = warning
515515
insert_final_newline = false
516516

517517
# Verify settings
518-
[*.{received,verified}.{txt,xml,json}]
518+
[*.{received,verified}.{txt,xml,json,sh,zsh,nu,fish,ps1}]
519519
charset = "utf-8-bom"
520520
end_of_line = lf
521521
indent_size = unset
522522
indent_style = unset
523523
insert_final_newline = false
524524
tab_width = unset
525-
trim_trailing_whitespace = false
525+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@
6767
*.verified.txt text eol=lf working-tree-encoding=UTF-8
6868
*.verified.xml text eol=lf working-tree-encoding=UTF-8
6969
*.verified.json text eol=lf working-tree-encoding=UTF-8
70+
*.verified.sh text eol=lf working-tree-encoding=UTF-8
71+
*.verified.zsh text eol=lf working-tree-encoding=UTF-8
72+
*.verified.nu text eol=lf working-tree-encoding=UTF-8
73+
*.verified.fish text eol=lf working-tree-encoding=UTF-8

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"dotnet.testWindow.disableAutoDiscovery": true,
3-
"dotnet.defaultSolution": "sdk.slnx"
3+
"dotnet.testWindow.disableBuildOnRun": true,
4+
"dotnet.defaultSolution": "cli.slnf",
5+
"files.associations": {
6+
"*.slnf": "json",
7+
"*.props": "xml",
8+
"*.targets": "xml",
9+
"*.*proj": "xml"
10+
}
411
}

cli.slnf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"solution": {
3+
"path": "sdk.slnx",
4+
"projects": [
5+
"src\\BuiltInTools\\dotnet-watch\\dotnet-watch.csproj",
6+
"src\\Cli\\dotnet\\dotnet.csproj",
7+
"src\\Cli\\Microsoft.DotNet.Cli.Utils\\Microsoft.DotNet.Cli.Utils.csproj",
8+
"test\\dotnet-new.IntegrationTests\\dotnet-new.IntegrationTests.csproj",
9+
"test\\dotnet-watch.Tests\\dotnet-watch.Tests.csproj",
10+
"test\\dotnet.Tests\\dotnet.Tests.csproj",
11+
"test\\Microsoft.DotNet.Cli.Utils.Tests\\Microsoft.DotNet.Cli.Utils.Tests.csproj",
12+
"test\\Microsoft.NET.TestFramework\\Microsoft.NET.TestFramework.csproj"
13+
]
14+
}
15+
}

documentation/general/analyzer-redirecting.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ Targeting an SDK (and hence also loading analyzers) with newer major version in
1919
2020
## Overview
2121

22-
- The SDK will contain a VSIX with the analyzer DLLs and an MEF-exported implementation of `IAnalyzerAssemblyRedirector`.
22+
- The SDK will deploy analyzer DLLs and Roslyn will deploy an implementation of `IAnalyzerAssemblyRedirector`
23+
(could be deployed by SDK but we are saving on analyzer loads and Roslyn already has a VSIX with a DLL).
2324
Implementations of this interface are imported by Roslyn and can redirect analyzer DLL loading.
2425

25-
- The SDK's implementation of `IAnalyzerAssemblyRedirector` will redirect any analyzer DLL matching some pattern
26-
to the corresponding DLL deployed via the VSIX.
26+
- That implementation of `IAnalyzerAssemblyRedirector` will redirect any analyzer DLL matching some pattern
27+
to the corresponding DLL deployed with VS.
2728
Details of this process are described below.
2829

2930
- Note that when `IAnalyzerAssemblyRedirector` is involved, Roslyn is free to not use shadow copy loading and instead load the DLLs directly.
@@ -33,7 +34,7 @@ Targeting an SDK (and hence also loading analyzers) with newer major version in
3334

3435
## Details
3536

36-
The VSIX contains some analyzers, for example:
37+
The VS deployment contains some analyzers, for example:
3738

3839
```
3940
AspNetCoreAnalyzers\analyzers\dotnet\cs\Microsoft.AspNetCore.App.Analyzers.dll
@@ -69,7 +70,7 @@ C:\Program Files\dotnet\sdk\9.0.100-preview.5.24307.3\Sdks\Microsoft.NET.Sdk\ana
6970
will be redirected to
7071

7172
```
72-
{VSIX}\SDKAnalyzers\Sdks\Microsoft.NET.Sdk\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll
73+
{InstallDir}\SDKAnalyzers\Sdks\Microsoft.NET.Sdk\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll
7374
```
7475

7576
where `metadata.json` has `"SDKAnalyzers": "9.0.100-dev"`, because
@@ -83,6 +84,5 @@ Analyzers that cannot be matched will continue to be loaded from the SDK
8384
### Implementation
8485

8586
Analyzer DLLs are contained in transport package `VS.Redist.Common.Net.Core.SDK.RuntimeAnalyzers`.
86-
The redirecting logic lives in "system" VS extension `Microsoft.Net.Sdk.AnalyzerRedirecting`.
8787

8888
[torn-sdk]: https://github.com/dotnet/sdk/issues/42087

documentation/general/dotnet-run-file.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Additionally, the implicit project file has the following customizations:
5656
in case there is a project or solution in the same directory as the file-based app.
5757
This ensures that items from nested projects and artifacts are not included by the app.
5858

59+
- `EnableDefaultEmbeddedResourceItems` and `EnableDefaultNoneItems` properties are set to `false` if the default SDK (`Microsoft.NET.Sdk`) is being used.
60+
This avoids including files like `./**/*.resx` in simple file-based apps where users usually don't expect that.
61+
5962
## Grow up
6063

6164
When file-based programs reach an inflection point where build customizations in a project file are needed,

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
<SystemReflectionMetadataLoadContextToolsetPackageVersion>9.0.0</SystemReflectionMetadataLoadContextToolsetPackageVersion>
8989
<SystemReflectionMetadataToolsetPackageVersion>9.0.0</SystemReflectionMetadataToolsetPackageVersion>
9090
<SystemDiagnosticsDiagnosticSourceToolsetPackageVersion>9.0.0</SystemDiagnosticsDiagnosticSourceToolsetPackageVersion>
91+
<SystemTextEncodingCodePagesToolsetPackageVersion>8.0.0</SystemTextEncodingCodePagesToolsetPackageVersion>
9192
<SystemTextJsonToolsetPackageVersion>9.0.0</SystemTextJsonToolsetPackageVersion>
9293
<SystemThreadingTasksExtensionsToolsetPackageVersion>4.5.4</SystemThreadingTasksExtensionsToolsetPackageVersion>
9394
<SystemResourcesExtensionsToolsetPackageVersion>8.0.0</SystemResourcesExtensionsToolsetPackageVersion>

sdk.slnx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
</Folder>
2525
<Folder Name="/src/">
2626
<Project Path="src/Microsoft.DotNet.TemplateLocator/Microsoft.DotNet.TemplateLocator.csproj" />
27-
<Project Path="src/Microsoft.Net.Sdk.AnalyzerRedirecting/Microsoft.Net.Sdk.AnalyzerRedirecting.csproj" />
2827
<Project Path="src/Microsoft.Net.Sdk.Compilers.Toolset/Microsoft.Net.Sdk.Compilers.Toolset.csproj" />
2928
<Project Path="src/Microsoft.Win32.Msi/Microsoft.Win32.Msi.csproj" />
3029
<Project Path="src/System.CommandLine.StaticCompletions/System.CommandLine.StaticCompletions.csproj" />
@@ -66,6 +65,7 @@
6665
<Project Path="src/Cli/Microsoft.DotNet.Cli.CommandLine/Microsoft.DotNet.Cli.CommandLine.csproj" />
6766
<Project Path="src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj" />
6867
<Project Path="src/Cli/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj" />
68+
<Project Path="src/Cli/Microsoft.DotNet.FileBasedPrograms/Microsoft.DotNet.FileBasedPrograms.Package.csproj" />
6969
<Project Path="src/Cli/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj" />
7070
<Project Path="src/Cli/Microsoft.TemplateEngine.Cli/Microsoft.TemplateEngine.Cli.csproj" />
7171
</Folder>
@@ -338,7 +338,6 @@
338338
<Project Path="test/Microsoft.NET.Publish.Tests/Microsoft.NET.Publish.Tests.csproj" />
339339
<Project Path="test/Microsoft.NET.Rebuild.Tests/Microsoft.NET.Rebuild.Tests.csproj" />
340340
<Project Path="test/Microsoft.NET.Restore.Tests/Microsoft.NET.Restore.Tests.csproj" />
341-
<Project Path="test/Microsoft.Net.Sdk.AnalyzerRedirecting.Tests/Microsoft.Net.Sdk.AnalyzerRedirecting.Tests.csproj" />
342341
<Project Path="test/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj" />
343342
<Project Path="test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj" />
344343
<Project Path="test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj" />

src/BuiltInTools/BrowserRefresh/Microsoft.AspNetCore.Watch.BrowserRefresh.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@
2525
</ItemGroup>
2626

2727
<Import Project="..\Web.Middleware\Microsoft.DotNet.HotReload.Web.Middleware.projitems" Label="Shared" />
28+
29+
<ItemGroup>
30+
<EmbeddedResource Update="@(EmbeddedResource)">
31+
<LogicalName>%(FileName)%(Extension)</LogicalName>
32+
</EmbeddedResource>
33+
</ItemGroup>
2834
</Project>

src/BuiltInTools/HotReloadClient/Web/AbstractBrowserRefreshServer.cs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ internal abstract class AbstractBrowserRefreshServer(string middlewareAssemblyPa
2929
{
3030
public const string ServerLogComponentName = "BrowserRefreshServer";
3131

32-
private static readonly ReadOnlyMemory<byte> s_reloadMessage = Encoding.UTF8.GetBytes("Reload");
33-
private static readonly ReadOnlyMemory<byte> s_waitMessage = Encoding.UTF8.GetBytes("Wait");
34-
private static readonly ReadOnlyMemory<byte> s_pingMessage = Encoding.UTF8.GetBytes("""{ "type" : "Ping" }""");
3532
private static readonly JsonSerializerOptions s_jsonSerializerOptions = new(JsonSerializerDefaults.Web);
3633

3734
private readonly List<BrowserConnection> _activeConnections = [];
@@ -233,19 +230,15 @@ public ValueTask SendJsonMessageAsync<TValue>(TValue value, CancellationToken ca
233230
public ValueTask SendReloadMessageAsync(CancellationToken cancellationToken)
234231
{
235232
logger.Log(LogEvents.ReloadingBrowser);
236-
return SendAsync(s_reloadMessage, cancellationToken);
233+
return SendAsync(JsonReloadRequest.Message, cancellationToken);
237234
}
238235

239236
public ValueTask SendWaitMessageAsync(CancellationToken cancellationToken)
240237
{
241238
logger.Log(LogEvents.SendingWaitMessage);
242-
return SendAsync(s_waitMessage, cancellationToken);
239+
return SendAsync(JsonWaitRequest.Message, cancellationToken);
243240
}
244241

245-
// obsolete: to be removed
246-
public ValueTask SendPingMessageAsync(CancellationToken cancellationToken)
247-
=> SendAsync(s_pingMessage, cancellationToken);
248-
249242
private ValueTask SendAsync(ReadOnlyMemory<byte> messageBytes, CancellationToken cancellationToken)
250243
=> SendAndReceiveAsync(request: _ => messageBytes, response: null, cancellationToken);
251244

@@ -293,13 +286,13 @@ public async ValueTask SendAndReceiveAsync<TRequest>(
293286
public ValueTask RefreshBrowserAsync(CancellationToken cancellationToken)
294287
{
295288
logger.Log(LogEvents.RefreshingBrowser);
296-
return SendJsonMessageAsync(new AspNetCoreHotReloadApplied(), cancellationToken);
289+
return SendAsync(JsonRefreshBrowserRequest.Message, cancellationToken);
297290
}
298291

299292
public ValueTask ReportCompilationErrorsInBrowserAsync(ImmutableArray<string> compilationErrors, CancellationToken cancellationToken)
300293
{
301294
logger.Log(LogEvents.UpdatingDiagnostics);
302-
return SendJsonMessageAsync(new HotReloadDiagnostics { Diagnostics = compilationErrors }, cancellationToken);
295+
return SendJsonMessageAsync(new JsonReportDiagnosticsRequest { Diagnostics = compilationErrors }, cancellationToken);
303296
}
304297

305298
public async ValueTask UpdateStaticAssetsAsync(IEnumerable<string> relativeUrls, CancellationToken cancellationToken)
@@ -308,24 +301,37 @@ public async ValueTask UpdateStaticAssetsAsync(IEnumerable<string> relativeUrls,
308301
foreach (var relativeUrl in relativeUrls)
309302
{
310303
logger.Log(LogEvents.SendingStaticAssetUpdateRequest, relativeUrl);
311-
var message = JsonSerializer.SerializeToUtf8Bytes(new UpdateStaticFileMessage { Path = relativeUrl }, s_jsonSerializerOptions);
304+
var message = JsonSerializer.SerializeToUtf8Bytes(new JasonUpdateStaticFileRequest { Path = relativeUrl }, s_jsonSerializerOptions);
312305
await SendAsync(message, cancellationToken);
313306
}
314307
}
315308

316-
private readonly struct AspNetCoreHotReloadApplied
309+
private readonly struct JsonWaitRequest
310+
{
311+
public string Type => "Wait";
312+
public static readonly ReadOnlyMemory<byte> Message = JsonSerializer.SerializeToUtf8Bytes(new JsonWaitRequest(), s_jsonSerializerOptions);
313+
}
314+
315+
private readonly struct JsonReloadRequest
316+
{
317+
public string Type => "Reload";
318+
public static readonly ReadOnlyMemory<byte> Message = JsonSerializer.SerializeToUtf8Bytes(new JsonReloadRequest(), s_jsonSerializerOptions);
319+
}
320+
321+
private readonly struct JsonRefreshBrowserRequest
317322
{
318-
public string Type => "AspNetCoreHotReloadApplied";
323+
public string Type => "RefreshBrowser";
324+
public static readonly ReadOnlyMemory<byte> Message = JsonSerializer.SerializeToUtf8Bytes(new JsonRefreshBrowserRequest(), s_jsonSerializerOptions);
319325
}
320326

321-
private readonly struct HotReloadDiagnostics
327+
private readonly struct JsonReportDiagnosticsRequest
322328
{
323-
public string Type => "HotReloadDiagnosticsv1";
329+
public string Type => "ReportDiagnostics";
324330

325331
public IEnumerable<string> Diagnostics { get; init; }
326332
}
327333

328-
private readonly struct UpdateStaticFileMessage
334+
private readonly struct JasonUpdateStaticFileRequest
329335
{
330336
public string Type => "UpdateStaticFile";
331337
public string Path { get; init; }

0 commit comments

Comments
 (0)