Skip to content

Commit 96b4876

Browse files
committed
Remove unnecessary try-catch in Worker template
This was working around a bug in 6.0 (dotnet/runtime#56032) which will be fixed in 6.0. So we no longer need this in the default template.
1 parent a1da5e9 commit 96b4876

File tree

1 file changed

+1
-8
lines changed
  • src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp

1 file changed

+1
-8
lines changed

src/ProjectTemplates/Web.ProjectTemplates/content/Worker-CSharp/Worker.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
1414
while (!stoppingToken.IsCancellationRequested)
1515
{
1616
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
17-
try
18-
{
19-
await Task.Delay(1000, stoppingToken);
20-
}
21-
catch (OperationCanceledException)
22-
{
23-
return;
24-
}
17+
await Task.Delay(1000, stoppingToken);
2518
}
2619
}
2720
}

0 commit comments

Comments
 (0)