Skip to content

host.DisposeAsync() を待たずに処理が進んでしまう #6

@in-async

Description

@in-async

Task.Run() のデリゲートで ValueTask を返している為:

await Task.Run(() => {
if (host is IAsyncDisposable asyncDisposable) {
return asyncDisposable.DisposeAsync();
}
host.Dispose();
return default;
}).ConfigureAwait(false);

Task を返すようにすれば解決:

 await Task.Run(() => { 
     if (host is IAsyncDisposable asyncDisposable) { 
         return asyncDisposable.DisposeAsync().AsTask(); 
     } 
  
     host.Dispose(); 
     return Task.CompletedTask;
 }).ConfigureAwait(false); 

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions