Shutdown and Draining
The default behavior of most SDKs is to send out events over the network asynchronously in the background. This means that some events might be lost if the application shuts down unexpectedly. The SDKs provide mechanisms to cope with this.
The .NET SDK gracefully handles shutdown, waiting up to
ShutdownTimeout seconds to flush captured events.
This happens in a variety of different situations:
- Automatically, in the case of a normal application exit.
- Automatically, in the case of an unhandled exception.
- Automatically, for integrations that use dependency injection (
- Manually, if you dispose of the result of
SentrySdk.Init(which is optional).
- Manually, if you call
In most cases, you can rely on the automatic approaches and don't need to worry about this.