We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73c5df9 commit 5695157Copy full SHA for 5695157
release-notes/10.0/preview/preview6/aspnetcore.md
@@ -48,11 +48,17 @@ public class MyBackgroundService : BackgroundService
48
{
49
while (!stoppingToken.IsCancellationRequested)
50
51
- // Use memory from the pool
52
- var rented = _memoryPool.Rent(100);
53
- // ... do work ...
54
- rented.Dispose();
55
- await Task.Delay(20, stoppingToken);
+ try
+ {
+ await Task.Delay(20, stoppingToken);
+ // do work that needs memory
+ var rented = _memoryPool.Rent(100);
56
+ rented.Dispose();
57
+ }
58
+ catch (OperationCanceledException)
59
60
+ return;
61
62
}
63
64
0 commit comments