Skip to content

Commit c4f8c3b

Browse files
authored
Upgrade MicrosoftCodeAnalysisVersion_LatestVS version to 4.7.0 (#91006)
* Upgrade MicrosoftCodeAnalysisVersion_LatestVS version to 4.7.0 * Fix IDE issue with ILLink.RoslynAnalyzer * Remove source build allowed prebuilt entry for version 4.5.0 * Add tracking issue links
1 parent adbeca2 commit c4f8c3b

File tree

7 files changed

+30
-3
lines changed

7 files changed

+30
-3
lines changed

eng/SourceBuildPrebuiltBaseline.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<UsagePattern IdentityGlob="System.Composition*/*6.*" />
1010
<UsagePattern IdentityGlob="System.Composition*/*7.*" />
1111
<UsagePattern IdentityGlob="Microsoft.CodeAnalysis*/*4.4.*" />
12-
<UsagePattern IdentityGlob="Microsoft.CodeAnalysis*/*4.5.*" />
1312
<UsagePattern IdentityGlob="Microsoft.CodeAnalysis*/*4.7.*" />
1413

1514
<!-- Allowed and pinned to major version due to https://github.com/dotnet/source-build/issues/3228 -->

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
Source-build builds the product with the most recent previously source-built release. Thankfully, these two requirements line up nicely
7070
such that any version that satisfies the VS version requirement will also satisfy the .NET SDK version requirement because of how we ship.
7171
-->
72-
<MicrosoftCodeAnalysisVersion_LatestVS>4.5.0</MicrosoftCodeAnalysisVersion_LatestVS>
72+
<MicrosoftCodeAnalysisVersion_LatestVS>4.7.0</MicrosoftCodeAnalysisVersion_LatestVS>
7373
<!-- Some of the analyzer dependencies used by ILLink project -->
7474
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.3.5-beta1.23270.2</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
7575
</PropertyGroup>

src/coreclr/tools/Directory.Build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@
1212
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
1313
<DefineConstants>DEBUG;$(DefineConstants)</DefineConstants>
1414
</PropertyGroup>
15+
16+
<!--
17+
These packages affect the design-time experience in VS, we update them
18+
at the same cadance as the MicrosoftCodeAnalysisVersion_LatestVS version.
19+
This property is set eng/Versions.props but we override it because the current
20+
version 4.7.0 flags several warnings that need area-owner expertise to resolve.
21+
TODO: https://github.com/dotnet/runtime/issues/91028.
22+
-->
23+
<PropertyGroup>
24+
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>4.5.0</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
25+
</PropertyGroup>
1526
</Project>

src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Microsoft.Extensions.Configuration.Binder.SourceGeneration.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0-3.23314.3" PrivateAssets="all" />
13+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisVersion_LatestVS)" PrivateAssets="all" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/libraries/System.Text.RegularExpressions/gen/UpgradeToGeneratedRegexCodeFixer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,10 @@ private static async Task<Document> ConvertToSourceGenerator(Document document,
210210
// it in as a parameter. If the user specified IgnoreCase, but also selected CultureInvariant, then we skip as the default is to use Invariant culture.
211211
if ((regexOptions & RegexOptions.IgnoreCase) != 0 && (regexOptions & RegexOptions.CultureInvariant) == 0)
212212
{
213+
#pragma warning disable RS1035 // The symbol 'CultureInfo.CurrentCulture' is banned for use by analyzers.
213214
// If CultureInvariant wasn't specified as options, we default to the current culture.
214215
cultureNameValue = generator.LiteralExpression(CultureInfo.CurrentCulture.Name);
216+
#pragma warning restore RS1035
215217

216218
// If options weren't passed in, then we need to define it as well in order to use the three parameter constructor.
217219
regexOptionsValue ??= generator.MemberAccessExpression(SyntaxFactory.IdentifierName("RegexOptions"), "None");

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexParser.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ private RegexParser(string pattern, RegexOptions options, CultureInfo culture, H
8383

8484
/// <summary>Gets the culture to use based on the specified options.</summary>
8585
internal static CultureInfo GetTargetCulture(RegexOptions options) =>
86+
#pragma warning disable RS1035 // The symbol 'CultureInfo.CurrentCulture' is banned for use by analyzers.
8687
(options & RegexOptions.CultureInvariant) != 0 ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture;
88+
#pragma warning restore RS1035
8789

8890
public static RegexOptions ParseOptionsInPattern(string pattern, RegexOptions options)
8991
{
@@ -134,7 +136,9 @@ public static RegexTree Parse(string pattern, RegexOptions options, CultureInfo
134136
/// <summary>This static call constructs a flat concatenation node given a replacement pattern.</summary>
135137
public static RegexReplacement ParseReplacement(string pattern, RegexOptions options, Hashtable caps, int capsize, Hashtable capnames)
136138
{
139+
#pragma warning disable RS1035 // The symbol 'CultureInfo.CurrentCulture' is banned for use by analyzers.
137140
CultureInfo culture = (options & RegexOptions.CultureInvariant) != 0 ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture;
141+
#pragma warning restore RS1035
138142
using var parser = new RegexParser(pattern, options, culture, caps, capsize, capnames, stackalloc int[OptionStackDefaultSize]);
139143

140144
RegexNode root = parser.ScanReplacement();

src/tools/illink/src/ILLink.RoslynAnalyzer/Directory.Build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,15 @@
55
</PropertyGroup>
66

77
<Import Project="..\Directory.Build.props" />
8+
9+
<!--
10+
These packages affect the design-time experience in VS, we update them
11+
at the same cadance as the MicrosoftCodeAnalysisVersion_LatestVS version.
12+
This property is set eng/Versions.props but we override it because the current
13+
version 4.7.0 flags several warnings that need area-owner expertise to resolve.
14+
TODO: https://github.com/dotnet/runtime/issues/91030.
15+
-->
16+
<PropertyGroup>
17+
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>4.5.0</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
18+
</PropertyGroup>
819
</Project>

0 commit comments

Comments
 (0)