Skip to content

Commit 0739b5a

Browse files
authored
Merge branch 'release/10.0.2xx' into merge/release/10.0.1xx-to-release/10.0.2xx
2 parents b43b2ec + 30287ee commit 0739b5a

File tree

92 files changed

+2305
-1981
lines changed

Some content is hidden

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

92 files changed

+2305
-1981
lines changed

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

eng/Version.Details.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
3-
<Source Uri="https://github.com/dotnet/dotnet" Mapping="sdk" Sha="79c85d969a02abd06c2202949318fd4c21e5e7a0" BarId="287426" />
3+
<Source Uri="https://github.com/dotnet/dotnet" Mapping="sdk" Sha="5558d2da527906dd610d5bfa63177e67e515b5e7" BarId="285880" />
44
<ProductDependencies>
55
<Dependency Name="Microsoft.TemplateEngine.Abstractions" Version="10.0.100-rc.2.25502.107">
66
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-dotnet</Uri>

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: 0 additions & 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" />
@@ -337,7 +336,6 @@
337336
<Project Path="test/Microsoft.NET.Publish.Tests/Microsoft.NET.Publish.Tests.csproj" />
338337
<Project Path="test/Microsoft.NET.Rebuild.Tests/Microsoft.NET.Rebuild.Tests.csproj" />
339338
<Project Path="test/Microsoft.NET.Restore.Tests/Microsoft.NET.Restore.Tests.csproj" />
340-
<Project Path="test/Microsoft.Net.Sdk.AnalyzerRedirecting.Tests/Microsoft.Net.Sdk.AnalyzerRedirecting.Tests.csproj" />
341339
<Project Path="test/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests.csproj" />
342340
<Project Path="test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests.csproj" />
343341
<Project Path="test/Microsoft.NET.Sdk.Publish.Tasks.Tests/Microsoft.NET.Sdk.Publish.Tasks.Tests.csproj" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Note: this editorconfig is *only* used during local builds.
2+
# The actual source package will include 'eng\config\SourcePackage.editorconfig' or similar per-TFM config to control analyzer behavior at the consumption side.
3+
4+
[*.cs]
5+
# IDE0240: Remove redundant nullable directive
6+
# The directive needs to be included since all sources in a source package are considered generated code
7+
# when referenced from a project via package reference.
8+
dotnet_diagnostic.IDE0240.severity = none
9+
10+
dotnet_diagnostic.RS0051.severity = warning # Add internal types and members to the declared API
11+
dotnet_diagnostic.RS0052.severity = warning # Remove deleted types and members from the declared internal API
12+
dotnet_diagnostic.RS0053.severity = warning # The contents of the internal API files are invalid
13+
dotnet_diagnostic.RS0054.severity = warning # Do not duplicate symbols in internal API files
14+
dotnet_diagnostic.RS0055.severity = warning # Annotate nullability of internal types and members in the declared API
15+
dotnet_diagnostic.RS0056.severity = warning # Enable tracking of nullability of reference types in the declared API
16+
dotnet_diagnostic.RS0057.severity = warning # Internal members should not use oblivious types
17+
dotnet_diagnostic.RS0058.severity = warning # Missing shipped or unshipped internal API file
18+
dotnet_diagnostic.RS0059.severity = warning # Do not add multiple public overloads with optional parameters
19+
dotnet_diagnostic.RS0060.severity = warning # API with optional parameter(s) should have the most parameters amongst its public overloads
20+
dotnet_diagnostic.RS0061.severity = warning # Constructor make noninheritable base class inheritable
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
#nullable enable
5+
using System;
6+
using System.IO;
7+
8+
namespace Microsoft.DotNet.FileBasedPrograms;
9+
10+
/// <summary>
11+
/// When targeting netstandard2.0, the user of the source package must "implement" certain methods by declaring members in this type.
12+
/// </summary>
13+
internal partial class ExternalHelpers
14+
{
15+
public static partial int CombineHashCodes(int value1, int value2);
16+
public static partial string GetRelativePath(string relativeTo, string path);
17+
18+
public static partial bool IsPathFullyQualified(string path);
19+
20+
#if NET
21+
public static partial int CombineHashCodes(int value1, int value2)
22+
=> HashCode.Combine(value1, value2);
23+
24+
public static partial string GetRelativePath(string relativeTo, string path)
25+
=> Path.GetRelativePath(relativeTo, path);
26+
27+
public static partial bool IsPathFullyQualified(string path)
28+
=> Path.IsPathFullyQualified(path);
29+
30+
#elif FILE_BASED_PROGRAMS_SOURCE_PACKAGE_BUILD
31+
// This path should only be used when we are verifying that the source package itself builds under netstandard2.0.
32+
public static partial int CombineHashCodes(int value1, int value2)
33+
=> throw new NotImplementedException();
34+
35+
public static partial string GetRelativePath(string relativeTo, string path)
36+
=> throw new NotImplementedException();
37+
38+
public static partial bool IsPathFullyQualified(string path)
39+
=> throw new NotImplementedException();
40+
41+
#endif
42+
}
43+
44+
// https://github.com/dotnet/sdk/issues/51487: Remove usage of GracefulException from the source package
45+
#if FILE_BASED_PROGRAMS_SOURCE_PACKAGE_GRACEFUL_EXCEPTION
46+
internal class GracefulException : Exception
47+
{
48+
public GracefulException()
49+
{
50+
}
51+
52+
public GracefulException(string? message) : base(message)
53+
{
54+
}
55+
56+
public GracefulException(string format, string arg) : this(string.Format(format, arg))
57+
{
58+
}
59+
60+
public GracefulException(string? message, Exception? innerException) : base(message, innerException)
61+
{
62+
}
63+
}
64+
#endif
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<data name="CouldNotFindAnyProjectInDirectory" xml:space="preserve">
121+
<value>Could not find any project in `{0}`.</value>
122+
</data>
123+
<data name="CouldNotFindProjectOrDirectory" xml:space="preserve">
124+
<value>Could not find project or directory `{0}`.</value>
125+
</data>
126+
<data name="MoreThanOneProjectInDirectory" xml:space="preserve">
127+
<value>Found more than one project in `{0}`. Specify which one to use.</value>
128+
</data>
129+
<data name="PropertyDirectiveInvalidName" xml:space="preserve">
130+
<value>Invalid property name: {0}</value>
131+
<comment>{0} is an inner exception message.</comment>
132+
</data>
133+
<data name="PropertyDirectiveMissingParts" xml:space="preserve">
134+
<value>The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue'.</value>
135+
<comment>{Locked="#:property"}</comment>
136+
</data>
137+
<data name="StaticGraphRestoreNotSupported" xml:space="preserve">
138+
<value>Static graph restore is not supported for file-based apps. Remove the '#:property'.</value>
139+
<comment>{Locked="#:property"}</comment>
140+
</data>
141+
<data name="DirectiveError" xml:space="preserve">
142+
<value>error</value>
143+
<comment>Used when reporting directive errors like "file(location): error: message".</comment>
144+
</data>
145+
<data name="InvalidDirectiveName" xml:space="preserve">
146+
<value>The directive should contain a name without special characters and an optional value separated by '{1}' like '#:{0} Name{1}Value'.</value>
147+
<comment>{0} is the directive type like 'package' or 'sdk'. {1} is the expected separator like '@' or '='.</comment>
148+
</data>
149+
<data name="CannotConvertDirective" xml:space="preserve">
150+
<value>Some directives cannot be converted. Run the file to see all compilation errors. Specify '--force' to convert anyway.</value>
151+
<comment>{Locked="--force"}</comment>
152+
</data>
153+
<data name="DuplicateDirective" xml:space="preserve">
154+
<value>Duplicate directives are not supported: {0}</value>
155+
<comment>{0} is the directive type and name.</comment>
156+
</data>
157+
<data name="QuoteInDirective" xml:space="preserve">
158+
<value>Directives currently cannot contain double quotes (").</value>
159+
</data>
160+
<data name="InvalidProjectDirective" xml:space="preserve">
161+
<value>The '#:project' directive is invalid: {0}</value>
162+
<comment>{0} is the inner error message.</comment>
163+
</data>
164+
<data name="MissingDirectiveName" xml:space="preserve">
165+
<value>Missing name of '{0}'.</value>
166+
<comment>{0} is the directive name like 'package' or 'sdk'.</comment>
167+
</data>
168+
<data name="UnrecognizedDirective" xml:space="preserve">
169+
<value>Unrecognized directive '{0}'.</value>
170+
<comment>{0} is the directive name like 'package' or 'sdk'.</comment>
171+
</data>
172+
</root>

0 commit comments

Comments
 (0)