private async Task TerminateExistingInstancesAsync() { if (Component != null) { await StopComponentAsync(); } if (MessagePublisher != null) { await StopMessagePublisherAsync(); } MessagePublisher?.Dispose(); Component?.Dispose(); HostState = HostState.Destroyed; _serviceProvider = null; }