diff --git a/docs/platforms/dotnet/guides/uwp/index.mdx b/docs/platforms/dotnet/guides/uwp/index.mdx deleted file mode 100644 index 6f9f4082a4da7..0000000000000 --- a/docs/platforms/dotnet/guides/uwp/index.mdx +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: UWP -description: "Learn more about how Sentry's .NET SDK works with Universal Windows Platform (UWP) applications." ---- - -Sentry's .NET SDK works with Universal Windows platform applications through the [Sentry NuGet package](https://www.nuget.org/packages/Sentry). - -## Features - -In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). - -Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below. - -## Install - - - - - -## Configure - -In addition to [initializing the SDK with `SentrySdk.Init`](/platforms/dotnet/), you must configure the UWP specific `Application.UnhandledException` and `Application.Suspending` events. - - - -The SDK should be initialized in the constructor of your application class (usually `App.xaml.cs`). Do not initialize the SDK in the `OnLaunched` event of the application or the `Hub` will not be initialized correctly. - - - - -```csharp -using Sentry.Protocol; -using UnhandledExceptionEventArgs = Windows.UI.Xaml.UnhandledExceptionEventArgs; - -sealed partial class App : Application -{ - public App() - { - // Initialize Sentry in the App constructor before any other code, to ensure you capture all possible exceptions. - SentrySdk.Init(options => - { - // Tells which project in Sentry to send events to: - options.Dsn = "___PUBLIC_DSN___"; - - // When configuring for the first time, to see what the SDK is doing: - options.Debug = true; - - // Adds request URL and headers, IP and name for users, etc. - options.SendDefaultPii = true; - - // ___PRODUCT_OPTION_START___ performance - // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. - // We recommend adjusting this value in production. - options.TracesSampleRate = 1.0; - - // ___PRODUCT_OPTION_END___ performance - // Enable Global Mode since this is a client app. - options.IsGlobalModeEnabled = true; - - // TODO:Any other Sentry options you need go here. - }); - - // Hook the UWP UnhandledException event before initializing the app component. - this.UnhandledException += OnUnhandledException; - - // Initialize the app component, and hook the Suspending event. - this.InitializeComponent(); - this.Suspending += OnSuspending; - - // Add any other code you may need last. - } - - // Update your OnSuspending handler as shown - - private async void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - - // Flush Sentry events when suspending - await SentrySdk.FlushAsync(TimeSpan.FromSeconds(2)); - - // TODO: Save any other application state and stop any background activity. - - deferral.Complete(); - } - - // Add this OnUnhandledException handler. - - // Use these attributes to ensure all types of exceptions are handled. - [SecurityCritical] - [HandleProcessCorruptedStateExceptions] - private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) - { - // Get a reference to the exception, because the Exception property is cleared when accessed. - var exception = e.Exception; - if (exception != null) - { - // Tell Sentry this was an unhandled exception - exception.Data[Mechanism.HandledKey] = false; - exception.Data[Mechanism.MechanismKey] = "Application.UnhandledException"; - - // Capture the exception - SentrySdk.CaptureException(exception); - - // Flush the event immediately - SentrySdk.FlushAsync(TimeSpan.FromSeconds(2)).GetAwaiter().GetResult(); - } - } -} -``` - -## Verify - -This snippet includes an intentional error, so you can test that everything is working as soon as you set it up. - - diff --git a/redirects.js b/redirects.js index a8a7135a1ca0e..955a291bc6bfb 100644 --- a/redirects.js +++ b/redirects.js @@ -1222,6 +1222,11 @@ const userDocsRedirects = [ source: '/platforms/dotnet/guides/uwp/profiling/:path*', destination: '/platforms/dotnet/profiling/', }, + // General .NET redirects for UWP (deprecated) + { + source: '/platforms/dotnet/guides/uwp/:path*', + destination: '/platforms/dotnet/guides/maui/', + }, { source: '/platforms/dotnet/guides/aws-lambda/profiling/:path*', destination: '/platforms/dotnet/profiling/',