Skip to content

Commit ca2c367

Browse files
Copilot333fred
andcommitted
Comment out CS1998 warning definition and delete associated resources
Co-authored-by: 333fred <[email protected]>
1 parent 4139e06 commit ca2c367

File tree

9 files changed

+17
-12
lines changed

9 files changed

+17
-12
lines changed

src/Analyzers/CSharp/CodeFixes/MakeMethodSynchronous/CSharpMakeMethodSynchronousCodeFixProvider.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ namespace Microsoft.CodeAnalysis.CSharp.MakeMethodSynchronous;
2222
[method: SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
2323
internal sealed class CSharpMakeMethodSynchronousCodeFixProvider() : AbstractMakeMethodSynchronousCodeFixProvider
2424
{
25-
private const string CS1998 = nameof(CS1998); // This async method lacks 'await' operators and will run synchronously.
25+
// CS1998 warning has been removed entirely as per https://github.com/dotnet/roslyn/issues/77001
26+
// private const string CS1998 = nameof(CS1998); // This async method lacks 'await' operators and will run synchronously.
2627

27-
public override ImmutableArray<string> FixableDiagnosticIds { get; } = [CS1998];
28+
// Code fix provider disabled since CS1998 warning no longer exists
29+
public override ImmutableArray<string> FixableDiagnosticIds { get; } = [];
2830

2931
protected override bool IsAsyncSupportingFunctionSyntax(SyntaxNode node)
3032
=> node.IsAsyncSupportingFunctionSyntax();

src/Analyzers/CSharp/CodeFixes/RemoveAsyncModifier/CSharpRemoveAsyncModifierCodeFixProvider.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ namespace Microsoft.CodeAnalysis.CSharp.RemoveAsyncModifier;
2222
[method: SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")]
2323
internal sealed partial class CSharpRemoveAsyncModifierCodeFixProvider() : AbstractRemoveAsyncModifierCodeFixProvider<ReturnStatementSyntax, ExpressionSyntax>
2424
{
25-
private const string CS1998 = nameof(CS1998); // This async method lacks 'await' operators and will run synchronously.
25+
// CS1998 warning has been removed entirely as per https://github.com/dotnet/roslyn/issues/77001
26+
// private const string CS1998 = nameof(CS1998); // This async method lacks 'await' operators and will run synchronously.
2627

27-
public override ImmutableArray<string> FixableDiagnosticIds { get; } = [CS1998];
28+
// Code fix provider disabled since CS1998 warning no longer exists
29+
public override ImmutableArray<string> FixableDiagnosticIds { get; } = [];
2830

2931
protected override bool IsAsyncSupportingFunctionSyntax(SyntaxNode node)
3032
=> node.IsAsyncSupportingFunctionSyntax();

src/Analyzers/CSharp/Tests/MakeMethodSynchronous/MakeMethodSynchronousTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.MakeMethodSynchronous;
1717
CSharpMakeMethodSynchronousCodeFixProvider>;
1818

1919
[Trait(Traits.Feature, Traits.Features.CodeActionsMakeMethodSynchronous)]
20+
[Trait(Traits.Feature, Traits.Features.Skip)] // CS1998 warning removed entirely - https://github.com/dotnet/roslyn/issues/77001
2021
public sealed class MakeMethodSynchronousTests
2122
{
2223
[Fact]

src/Analyzers/CSharp/Tests/RemoveAsyncModifier/RemoveAsyncModifierTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveAsyncModifier;
1818
CSharpRemoveAsyncModifierCodeFixProvider>;
1919

2020
[Trait(Traits.Feature, Traits.Features.CodeActionsRemoveAsyncModifier)]
21+
[Trait(Traits.Feature, Traits.Features.Skip)] // CS1998 warning removed entirely - https://github.com/dotnet/roslyn/issues/77001
2122
public sealed class RemoveAsyncModifierTests
2223
{
2324
[Fact]

src/Compilers/CSharp/Portable/CSharpResources.resx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,12 +3833,14 @@ Give the compiler some way to differentiate the methods. For example, you can gi
38333833
<data name="ERR_BadAwaitInQuery" xml:space="preserve">
38343834
<value>The 'await' operator may only be used in a query expression within the first collection expression of the initial 'from' clause or within the collection expression of a 'join' clause</value>
38353835
</data>
3836+
<!-- WRN_AsyncLacksAwaits resources removed as per https://github.com/dotnet/roslyn/issues/77001
38363837
<data name="WRN_AsyncLacksAwaits" xml:space="preserve">
38373838
<value>This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.</value>
38383839
</data>
38393840
<data name="WRN_AsyncLacksAwaits_Title" xml:space="preserve">
38403841
<value>Async method lacks 'await' operators and will run synchronously</value>
38413842
</data>
3843+
-->
38423844
<data name="WRN_UnobservedAwaitableExpression" xml:space="preserve">
38433845
<value>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.</value>
38443846
</data>

src/Compilers/CSharp/Portable/Errors/ErrorCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ internal enum ErrorCode
10241024
ERR_BadAwaitInQuery = 1995,
10251025
ERR_BadAwaitInLock = 1996,
10261026
ERR_TaskRetNoObjectRequired = 1997,
1027-
WRN_AsyncLacksAwaits = 1998,
1027+
// WRN_AsyncLacksAwaits = 1998, // Removed as per https://github.com/dotnet/roslyn/issues/77001
10281028
ERR_FileNotFound = 2001,
10291029
WRN_FileAlreadyIncluded = 2002,
10301030
//ERR_DuplicateResponseFile = 2003,

src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ internal static int GetWarningLevel(ErrorCode code)
411411
case ErrorCode.WRN_CallerLineNumberPreferredOverCallerFilePath:
412412
case ErrorCode.WRN_DelaySignButNoKey:
413413
case ErrorCode.WRN_UnimplementedCommandLineSwitch:
414-
case ErrorCode.WRN_AsyncLacksAwaits:
414+
// case ErrorCode.WRN_AsyncLacksAwaits: // Removed as per https://github.com/dotnet/roslyn/issues/77001
415415
case ErrorCode.WRN_BadUILang:
416416
case ErrorCode.WRN_RefCultureMismatch:
417417
case ErrorCode.WRN_ConflictingMachineAssembly:
@@ -1485,7 +1485,7 @@ or ErrorCode.ERR_BadAsyncLacksBody
14851485
or ErrorCode.ERR_BadAwaitInQuery
14861486
or ErrorCode.ERR_BadAwaitInLock
14871487
or ErrorCode.ERR_TaskRetNoObjectRequired
1488-
or ErrorCode.WRN_AsyncLacksAwaits
1488+
// or ErrorCode.WRN_AsyncLacksAwaits // Removed as per https://github.com/dotnet/roslyn/issues/77001
14891489
or ErrorCode.ERR_FileNotFound
14901490
or ErrorCode.WRN_FileAlreadyIncluded
14911491
or ErrorCode.ERR_NoFileSpec

src/Compilers/CSharp/Portable/Generated/ErrorFacts.Generated.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Scripting/CSharpTest/CommandLineRunnerTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,14 @@ select x * x
5252
. {{
5353
. return new int[] {{ 1, 2, 3, 4, 5 }};
5454
. }}
55-
«Yellow»
56-
(1,19): warning CS1998: {CSharpResources.WRN_AsyncLacksAwaits}
57-
«Gray»
5855
> from x in await GetStuffAsync()
5956
. where x > 2
6057
. select x * x
6158
Enumerable.{iteratorType}<int, int> {{ 9, 16, 25 }}
6259
> ", runner.Console.Out.ToString());
6360

6461
AssertEx.AssertEqualToleratingWhitespaceDifferences(
65-
$@"(1,19): warning CS1998: {CSharpResources.WRN_AsyncLacksAwaits}",
62+
"",
6663
runner.Console.Error.ToString());
6764
}
6865

0 commit comments

Comments
 (0)