Skip to content

Commit fbcbf33

Browse files
committed
Remove analyser for configure await
1 parent d1ef5dd commit fbcbf33

File tree

23 files changed

+57
-61
lines changed

23 files changed

+57
-61
lines changed

src/.editorconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ insert_final_newline = false
2727
dotnet_diagnostic.CA1068.severity = error
2828
dotnet_diagnostic.CA1710.severity = error
2929
dotnet_diagnostic.CA1711.severity = error
30-
dotnet_diagnostic.CA2007.severity = error
30+
dotnet_diagnostic.CA2007.severity = none
3131
dotnet_diagnostic.CA2016.severity = error
3232

33-
3433
#### .NET Coding Conventions ####
3534

3635
# this. and Me. preferences

src/HealthCheckApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
throw new Exception("Missing URL");
88
}
99

10-
var response = await http.GetAsync(url).ConfigureAwait(false);
10+
var response = await http.GetAsync(url);
1111
response.EnsureSuccessStatusCode();
1212

1313
if (response.Content.Headers.ContentType?.MediaType != "application/json" || response.Content.Headers.ContentLength == 0)

src/ServiceControl.Config/.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
[*.cs]
22

3-
# Justification: Application synchronization contexts don't require ConfigureAwait(false)
4-
dotnet_diagnostic.CA2007.severity = none
5-
63
# may be enabled in future
74
dotnet_diagnostic.PS0003.severity = none # A parameter of type CancellationToken on a non-private delegate or method should be optional
85
dotnet_diagnostic.PS0013.severity = none # A Func used as a method parameter with a Task, ValueTask, or ValueTask<T> return type argument should have at least one CancellationToken parameter type argument unless it has a parameter type argument implementing ICancellableContext

src/ServiceControl.DomainEvents/DomainEvents.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task Raise<T>(T domainEvent, CancellationToken cancellationToken) w
2121
try
2222
{
2323
await handler.Handle(domainEvent, cancellationToken)
24-
.ConfigureAwait(false);
24+
;
2525
}
2626
catch (Exception e)
2727
{
@@ -36,7 +36,7 @@ await handler.Handle(domainEvent, cancellationToken)
3636
try
3737
{
3838
await handler.Handle(domainEvent, cancellationToken)
39-
.ConfigureAwait(false);
39+
;
4040
}
4141
catch (Exception e)
4242
{

src/ServiceControl.Infrastructure.Metrics/MetricsReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void Start()
2929
while (!tokenSource.IsCancellationRequested)
3030
{
3131
Print();
32-
await Task.Delay(interval, tokenSource.Token).ConfigureAwait(false);
32+
await Task.Delay(interval, tokenSource.Token);
3333
}
3434
}
3535
catch (OperationCanceledException) when (tokenSource.IsCancellationRequested)

src/ServiceControl.Infrastructure/AsyncTimer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ public TimerJob(Func<CancellationToken, Task<TimerJobExecutionResult>> callback,
2222
{
2323
try
2424
{
25-
await Task.Delay(due, token).ConfigureAwait(false);
25+
await Task.Delay(due, token);
2626

2727
while (!token.IsCancellationRequested)
2828
{
2929
try
3030
{
31-
var result = await callback(token).ConfigureAwait(false);
31+
var result = await callback(token);
3232
if (result == TimerJobExecutionResult.DoNotContinueExecuting)
3333
{
3434
tokenSource.Cancel();
3535
}
3636
else if (result == TimerJobExecutionResult.ScheduleNextExecution)
3737
{
38-
await Task.Delay(interval, token).ConfigureAwait(false);
38+
await Task.Delay(interval, token);
3939
}
4040

4141
//Otherwise execute immediately
@@ -64,14 +64,14 @@ public async Task Stop()
6464
return;
6565
}
6666

67-
await tokenSource.CancelAsync().ConfigureAwait(false);
67+
await tokenSource.CancelAsync();
6868
tokenSource.Dispose();
6969

7070
if (task != null)
7171
{
7272
try
7373
{
74-
await task.ConfigureAwait(false);
74+
await task;
7575
}
7676
catch (OperationCanceledException) when (tokenSource.IsCancellationRequested)
7777
{

src/ServiceControl.Infrastructure/IntegratedSetup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static async Task<int> Run()
5252
process.BeginOutputReadLine();
5353
process.BeginErrorReadLine();
5454

55-
await process.WaitForExitAsync().ConfigureAwait(false);
55+
await process.WaitForExitAsync();
5656

5757
return process.ExitCode;
5858
}

src/ServiceControl.Infrastructure/WaitHandleExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public static async Task<bool> WaitOneAsync(this WaitHandle handle, int millisec
2222
tokenRegistration = cancellationToken.Register(
2323
state => ((TaskCompletionSource<bool>)state).TrySetCanceled(),
2424
tcs);
25-
return await tcs.Task.ConfigureAwait(false);
25+
return await tcs.Task;
2626
}
2727
finally
2828
{
2929
registeredHandle?.Unregister(null);
30-
await tokenRegistration.DisposeAsync().ConfigureAwait(false);
30+
await tokenRegistration.DisposeAsync();
3131
}
3232
}
3333

src/ServiceControl.Infrastructure/Watchdog.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public Task Start(Action onFailedOnStartup, CancellationToken cancellationToken)
6161
cancellationTokenSource.CancelAfter(MaxStartDurationMs);
6262

6363
log.Debug($"Ensuring {taskName} is running");
64-
await ensureStarted(cancellationTokenSource.Token).ConfigureAwait(false);
64+
await ensureStarted(cancellationTokenSource.Token);
6565
clearFailure();
6666
startup = false;
6767
}
@@ -85,7 +85,7 @@ public Task Start(Action onFailedOnStartup, CancellationToken cancellationToken)
8585
}
8686
try
8787
{
88-
await Task.Delay(timeToWaitBetweenStartupAttempts, shutdownTokenSource.Token).ConfigureAwait(false);
88+
await Task.Delay(timeToWaitBetweenStartupAttempts, shutdownTokenSource.Token);
8989
}
9090
catch (OperationCanceledException) when (shutdownTokenSource.IsCancellationRequested)
9191
{
@@ -102,8 +102,8 @@ public async Task Stop(CancellationToken cancellationToken)
102102
try
103103
{
104104
log.Debug($"Stopping watching process {taskName}");
105-
await shutdownTokenSource.CancelAsync().ConfigureAwait(false);
106-
await watchdog.ConfigureAwait(false);
105+
await shutdownTokenSource.CancelAsync();
106+
await watchdog;
107107
}
108108
catch (Exception e)
109109
{
@@ -112,7 +112,7 @@ public async Task Stop(CancellationToken cancellationToken)
112112
}
113113
finally
114114
{
115-
await ensureStopped(cancellationToken).ConfigureAwait(false);
115+
await ensureStopped(cancellationToken);
116116
}
117117
}
118118
}

src/ServiceControl.Monitoring/.editorconfig

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)