Skip to content

Commit 3cefbb3

Browse files
Use modern extension (#79550)
2 parents 28aa933 + a21ed3c commit 3cefbb3

File tree

28 files changed

+107
-98
lines changed

28 files changed

+107
-98
lines changed

NuGet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
1010
<!-- We need dotnet7-transport because we depend on Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (>= 3.3.4-beta1.22504.1) -->
1111
<add key="dotnet7-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7-transport/nuget/v3/index.json" />
12-
<!-- We need dotnet8 because we depend on Microsoft.CodeAnalysis.NetAnalyzers (>= 8.0.0-preview.23468.1) -->
12+
<!-- We need dotnet8 because we depend on Microsoft.ILVerification (>= 8.0.0-rtm.23523.3) -->
1313
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
1414
<!-- We need dotnet9 because we depend on Roslyn.Diagnostics.Analyzers (>= 3.11.0-beta1.24081.1)-->
1515
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />

eng/Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<PropertyGroup>
33
<!-- Versions used by several individual references below -->
44
<RoslynDiagnosticsNugetPackageVersion>3.11.0-beta1.24081.1</RoslynDiagnosticsNugetPackageVersion>
5-
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23468.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
65
<MicrosoftCodeAnalysisTestingVersion>1.1.3-beta1.24319.1</MicrosoftCodeAnalysisTestingVersion>
76
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.796-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
87
<_BasicReferenceAssembliesVersion>1.8.3</_BasicReferenceAssembliesVersion>

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@
130130
<Uri>https://github.com/dotnet/arcade</Uri>
131131
<Sha>d777c20040bdc2e52b372fa98dcb84141ed692d3</Sha>
132132
</Dependency>
133-
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23468.1">
133+
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="10.0.0-preview.25375.1">
134134
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
135-
<Sha>2c9a20b6706b8a9ad650b41bff30980cf5af67ed</Sha>
135+
<Sha>dd67b33c8b4164fa2c2c1dd13b616aea3948f7da</Sha>
136136
</Dependency>
137137
<!-- Entries below are necessary for source-build. This allows the packages to be retrieved from previously-source-built
138138
artifacts and flow in as dependencies of the packages produced by roslyn. -->

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<SystemWindowsExtensionsVersion>9.0.0</SystemWindowsExtensionsVersion>
6969
<MicrosoftBclAsyncInterfacesVersion>9.0.0</MicrosoftBclAsyncInterfacesVersion>
7070
<MicrosoftCodeAnalysisAnalyzersVersion>5.0.0-1.25277.114</MicrosoftCodeAnalysisAnalyzersVersion>
71-
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23468.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
71+
<MicrosoftCodeAnalysisNetAnalyzersVersion>10.0.0-preview.25375.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
7272
<MicrosoftDiaSymReaderVersion>2.0.0</MicrosoftDiaSymReaderVersion>
7373
<MicrosoftExtensionsConfigurationVersion>9.0.0</MicrosoftExtensionsConfigurationVersion>
7474
<MicrosoftExtensionsDependencyInjectionVersion>9.0.0</MicrosoftExtensionsDependencyInjectionVersion>

eng/config/globalconfigs/Common.globalconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ dotnet_diagnostic.CA1052.severity = warning
1313
# CA2012: Use ValueTasks correctly
1414
dotnet_diagnostic.CA2012.severity = warning
1515

16+
# CA2022: Avoid inexact read with 'Stream.Read'
17+
dotnet_diagnostic.CA2022.severity = suggestion
18+
19+
# CA2265: Do not compare Span<T> to 'null' or 'default'
20+
dotnet_diagnostic.CA2265.severity = suggestion
21+
1622
# IDE0073: File header
1723
dotnet_diagnostic.IDE0073.severity = warning
1824

src/Analyzers/CSharp/Tests/UseVarTestExtensions.cs

Lines changed: 73 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,83 +22,86 @@ internal static class UseVarTestExtensions
2222
private static readonly CodeStyleOption2<bool> offWithError = new(false, NotificationOption2.Error);
2323
private static readonly CodeStyleOption2<bool> onWithError = new(true, NotificationOption2.Error);
2424

25-
public static OptionsCollection PreferExplicitTypeWithError(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
26-
=> new(test.GetLanguage())
27-
{
28-
{ CSharpCodeStyleOptions.VarElsewhere, offWithError },
29-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithError },
30-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithError },
31-
};
25+
extension(AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
26+
{
27+
public OptionsCollection PreferExplicitTypeWithError()
28+
=> new(test.GetLanguage())
29+
{
30+
{ CSharpCodeStyleOptions.VarElsewhere, offWithError },
31+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithError },
32+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithError },
33+
};
3234

33-
public static OptionsCollection PreferImplicitTypeWithError(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
34-
=> new(test.GetLanguage())
35-
{
36-
{ CSharpCodeStyleOptions.VarElsewhere, onWithError },
37-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithError },
38-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithError },
39-
};
35+
public OptionsCollection PreferImplicitTypeWithError()
36+
=> new(test.GetLanguage())
37+
{
38+
{ CSharpCodeStyleOptions.VarElsewhere, onWithError },
39+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithError },
40+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithError },
41+
};
4042

41-
public static OptionsCollection PreferExplicitTypeWithWarning(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
42-
=> new(test.GetLanguage())
43-
{
44-
{ CSharpCodeStyleOptions.VarElsewhere, offWithWarning },
45-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithWarning },
46-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithWarning },
47-
};
43+
public OptionsCollection PreferExplicitTypeWithWarning()
44+
=> new(test.GetLanguage())
45+
{
46+
{ CSharpCodeStyleOptions.VarElsewhere, offWithWarning },
47+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithWarning },
48+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithWarning },
49+
};
4850

49-
public static OptionsCollection PreferImplicitTypeWithWarning(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
50-
=> new(test.GetLanguage())
51-
{
52-
{ CSharpCodeStyleOptions.VarElsewhere, onWithWarning },
53-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithWarning },
54-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithWarning },
55-
};
51+
public OptionsCollection PreferImplicitTypeWithWarning()
52+
=> new(test.GetLanguage())
53+
{
54+
{ CSharpCodeStyleOptions.VarElsewhere, onWithWarning },
55+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithWarning },
56+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithWarning },
57+
};
5658

57-
public static OptionsCollection PreferExplicitTypeWithInfo(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
58-
=> new(test.GetLanguage())
59-
{
60-
{ CSharpCodeStyleOptions.VarElsewhere, offWithInfo },
61-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithInfo },
62-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo },
63-
};
59+
public OptionsCollection PreferExplicitTypeWithInfo()
60+
=> new(test.GetLanguage())
61+
{
62+
{ CSharpCodeStyleOptions.VarElsewhere, offWithInfo },
63+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithInfo },
64+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo },
65+
};
6466

65-
public static OptionsCollection PreferImplicitTypeWithInfo(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
66-
=> new(test.GetLanguage())
67-
{
68-
{ CSharpCodeStyleOptions.VarElsewhere, onWithInfo },
69-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithInfo },
70-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithInfo },
71-
};
67+
public OptionsCollection PreferImplicitTypeWithInfo()
68+
=> new(test.GetLanguage())
69+
{
70+
{ CSharpCodeStyleOptions.VarElsewhere, onWithInfo },
71+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithInfo },
72+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithInfo },
73+
};
7274

73-
public static OptionsCollection PreferExplicitTypeWithSilent(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
74-
=> new(test.GetLanguage())
75-
{
76-
{ CSharpCodeStyleOptions.VarElsewhere, offWithSilent },
77-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithSilent },
78-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithSilent },
79-
};
75+
public OptionsCollection PreferExplicitTypeWithSilent()
76+
=> new(test.GetLanguage())
77+
{
78+
{ CSharpCodeStyleOptions.VarElsewhere, offWithSilent },
79+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithSilent },
80+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithSilent },
81+
};
8082

81-
public static OptionsCollection PreferImplicitTypeWithSilent(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
82-
=> new(test.GetLanguage())
83-
{
84-
{ CSharpCodeStyleOptions.VarElsewhere, onWithSilent },
85-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithSilent },
86-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithSilent },
87-
};
83+
public OptionsCollection PreferImplicitTypeWithSilent()
84+
=> new(test.GetLanguage())
85+
{
86+
{ CSharpCodeStyleOptions.VarElsewhere, onWithSilent },
87+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithSilent },
88+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithSilent },
89+
};
8890

89-
public static OptionsCollection PreferExplicitTypeWithNone(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
90-
=> new(test.GetLanguage())
91-
{
92-
{ CSharpCodeStyleOptions.VarElsewhere, offWithNone },
93-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithNone },
94-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithNone },
95-
};
91+
public OptionsCollection PreferExplicitTypeWithNone()
92+
=> new(test.GetLanguage())
93+
{
94+
{ CSharpCodeStyleOptions.VarElsewhere, offWithNone },
95+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithNone },
96+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, offWithNone },
97+
};
9698

97-
public static OptionsCollection PreferImplicitTypeWithNone(this AbstractCodeActionOrUserDiagnosticTest_NoEditor<TestHostDocument, TestHostProject, TestHostSolution, TestWorkspace> test)
98-
=> new(test.GetLanguage())
99-
{
100-
{ CSharpCodeStyleOptions.VarElsewhere, onWithNone },
101-
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithNone },
102-
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithNone },
103-
};
99+
public OptionsCollection PreferImplicitTypeWithNone()
100+
=> new(test.GetLanguage())
101+
{
102+
{ CSharpCodeStyleOptions.VarElsewhere, onWithNone },
103+
{ CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithNone },
104+
{ CSharpCodeStyleOptions.VarForBuiltInTypes, onWithNone },
105+
};
106+
}
104107
}

src/Analyzers/Core/CodeFixes/ImplementInterface/AbstractImplementInterfaceService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public async Task<ImmutableArray<CodeAction>> GetCodeActionsAsync(Document docum
157157
return [];
158158

159159
using var _ = ArrayBuilder<CodeAction>.GetInstance(out var codeActions);
160-
await foreach (var implementOptions in GetImplementOptionsAsync(document, info, cancellationToken))
160+
await foreach (var implementOptions in GetImplementOptionsAsync(document, info, cancellationToken).ConfigureAwait(false))
161161
{
162162
var title = GetTitle(implementOptions);
163163
var equivalenceKey = GetEquivalenceKey(info, implementOptions);

src/Dependencies/Threading/ProducerConsumer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static IAsyncEnumerable<TItem> RunAsync<TArgs>(
265265
outerArgs.produceItems(callback, outerArgs.args, cancellationToken),
266266
consumeItems: async static (reader, args, cancellationToken) =>
267267
{
268-
await foreach (var item in reader.ReadAllAsync(cancellationToken))
268+
await foreach (var item in reader.ReadAllAsync(cancellationToken).ConfigureAwait(false))
269269
args.channel.Writer.TryWrite(item);
270270

271271
return default(VoidResult);

src/EditorFeatures/Core/FindUsages/BufferedFindUsagesContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ async ValueTask IFindUsagesContext.OnReferencesFoundAsync(IAsyncEnumerable<Sourc
212212
}
213213
else
214214
{
215-
await foreach (var reference in references)
215+
await foreach (var reference in references.ConfigureAwait(false))
216216
_state.References.Add(reference);
217217
}
218218
}

src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ private static async Task ProcessReferencesAsync(
351351
IAsyncEnumerable<ImmutableArray<SymbolReference>> reader,
352352
CancellationTokenSource linkedTokenSource)
353353
{
354-
await foreach (var symbolReferences in reader)
354+
await foreach (var symbolReferences in reader.ConfigureAwait(false))
355355
{
356356
linkedTokenSource.Token.ThrowIfCancellationRequested();
357357
AddRange(allSymbolReferences, symbolReferences);

0 commit comments

Comments
 (0)