You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement IHost in BotApp and enhance lifecycle management
BotApp.cs:
- Implemented IHost interface in BotApp class.
- Added private field _disposed to track disposal state.
- Added CancellationTokenSource field _cancellationTokenSource.
- Updated constructor to accept a CancellationTokenSource parameter.
- Updated Run method to use a merged cancellation token.
- Added StartAsync, StopAsync, Dispose, and MergeTokens methods.
- Updated ErrorHandler, UpdateHandler, and HandleRequestAsync to call CheckDisposed.
- Added private method CheckDisposed to throw ObjectDisposedException.
BotBuilder.cs:
- Updated BotBuilder to create and pass a CancellationTokenSource to BotApp.
HostApplicationLifetime.cs:
- Updated to accept a CancellationTokenSource through its constructor.
- Removed creation of its own CancellationTokenSource.