File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
ValidCode.NetCore/AsyncDisposable Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1+ namespace ValidCode . NetCore . AsyncDisposable
2+ {
3+ using System ;
4+ using System . IO ;
5+ using System . Threading . Tasks ;
6+
7+ public class Impl1 : IAsyncDisposable
8+ {
9+ private readonly IAsyncDisposable disposable = File . OpenRead ( string . Empty ) ;
10+
11+ public async ValueTask DisposeAsync ( )
12+ {
13+ await this . disposable . DisposeAsync ( ) . ConfigureAwait ( false ) ;
14+ }
15+ }
16+ }
Original file line number Diff line number Diff line change 44 using System . IO ;
55 using System . Threading . Tasks ;
66
7- public class Impl : IAsyncDisposable
7+ public class Impl2 : IAsyncDisposable
88 {
99 private readonly IAsyncDisposable disposable = File . OpenRead ( string . Empty ) ;
1010
Original file line number Diff line number Diff line change 66
77 public class Issue199 : IAsyncDisposable
88 {
9- private Timer _timer ;
9+ private Timer ? _timer ;
1010
1111 public async Task ResetTimerAsync ( )
1212 {
@@ -19,7 +19,10 @@ public async Task ResetTimerAsync()
1919
2020 public async ValueTask DisposeAsync ( )
2121 {
22- await _timer . DisposeAsync ( ) ;
22+ if ( this . _timer is { } )
23+ {
24+ await _timer . DisposeAsync ( ) . ConfigureAwait ( false ) ;
25+ }
2326 }
2427 }
2528}
You can’t perform that action at this time.
0 commit comments