diff --git a/docs/platforms/dotnet/common/configuration/filtering.mdx b/docs/platforms/dotnet/common/configuration/filtering.mdx
index 1bc850effda86..a8ddbd30d4c40 100644
--- a/docs/platforms/dotnet/common/configuration/filtering.mdx
+++ b/docs/platforms/dotnet/common/configuration/filtering.mdx
@@ -22,6 +22,48 @@ The SDK supports the callback method.
Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](/product/issues/issue-details/breadcrumbs/).
+#### Filtering by Unhandled or Terminal Exceptions
+
+When filtering events in , you may want to treat unhandled exceptions differently from handled ones. For example, you might drop noisy exceptions (like network timeouts) if these were handled, but capture them if they crashed your app.
+
+The SDK provides two extension methods on `SentryEvent` to enable this:
+
+- `IsFromUnhandledException()` returns `true` when the event came from an exception that wasn't caught by your application code, but was instead captured through an unhandled exception hook (such as `AppDomain.UnhandledException`, ASP.NET Core middleware, or another integration).
+- `IsFromTerminalException()` returns `true` only when the unhandled exception caused the application to crash. Some integrations capture unhandled exceptions that don't terminate the process (for example, unobserved task exceptions) and mark them as non-terminal.
+
+```csharp
+options.SetBeforeSend((sentryEvent, hint) =>
+{
+ // Always send unhandled exceptions, even if they'd be filtered below
+ if (sentryEvent.IsFromUnhandledException())
+ {
+ return sentryEvent;
+ }
+
+ // Drop noisy handled exceptions
+ if (sentryEvent.Exception is HttpRequestException)
+ {
+ return null; // Don't send this event to Sentry
+ }
+
+ return sentryEvent;
+});
+```
+
+```fsharp
+open Sentry
+open System.Net.Http
+
+options.SetBeforeSend(fun sentryEvent hint ->
+ if sentryEvent.IsFromUnhandledException() then
+ sentryEvent // Always send unhandled exceptions, even if filtered below
+ elif (sentryEvent.Exception :? HttpRequestException) then
+ null // Drop noisy handled exceptions
+ else
+ sentryEvent
+ )
+```
+
### Using and
The SDK also allows you to provide your own, custom exception filters. These have to inherit from
diff --git a/platform-includes/configuration/before-send/dotnet.mdx b/platform-includes/configuration/before-send/dotnet.mdx
index 8b866eeb8bb9e..f4027d2a5b83a 100644
--- a/platform-includes/configuration/before-send/dotnet.mdx
+++ b/platform-includes/configuration/before-send/dotnet.mdx
@@ -19,11 +19,11 @@ options.SetBeforeSend((sentryEvent, hint) =>
open Sentry
// Add this to the SDK initialization callback
-options.SetBeforeSend(fun event hint ->
- if event.Exception <> null && event.Exception.Message.Contains("Noisy Exception") then
+options.SetBeforeSend(fun sentryEvent hint ->
+ if sentryEvent.Exception <> null && sentryEvent.Exception.Message.Contains("Noisy Exception") then
null // Don't send this event to Sentry
else
- event.ServerName <- null // Never send Server Name to Sentry
- event
+ sentryEvent.ServerName <- null // Never send Server Name to Sentry
+ sentryEvent
)
```