private async Task StopAll() { Log.Information("Disposing all"); try { await _container.DisposeAsync().AsTask(); Log.Information("Disposed all"); } catch (Exception e) { Log.Error(e, "Dispose all failed"); } await Task.Delay(400); // wait for everything is done. Log.Information("Closing connection"); await Task.Run(() => Log.CloseAndFlush()); // no loging after this point if (_hubConnectionService.Connection != null) { await _hubConnectionService.Connection.DisposeAsync(); } await _mainVpnModel.StopAsync(); }
protected override void Dispose(bool disposing) { // Dispose the hub lifetime scope when the hub is disposed. if (disposing) { HubScope.DisposeAsync(); } base.Dispose(disposing); }
protected override async ValueTask DisposeAsync(bool disposing) { if (disposing) { await _rootLifetimeScope.DisposeAsync(); // Registries are not likely to have async tasks to dispose of, // so we will leave it as a straight dispose. ComponentRegistry.Dispose(); } // Do not call the base, otherwise the standard Dispose will fire. }
public override void Destroy() { base.Destroy(); AutofacScope?.DisposeAsync(); }
public async Task Close_container() { await _scope.DisposeAsync(); await _container.DisposeAsync(); }
public ValueTask DisposeAsync() { return(_lifetimeScope.DisposeAsync()); }