import {Fragment} from 'react'; import styled from '@emotion/styled'; import {Alert} from 'sentry/components/alert'; import ExternalLink from 'sentry/components/links/externalLink'; import List from 'sentry/components/list'; import ListItem from 'sentry/components/list/listItem'; import {Layout, LayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/layout'; import {ModuleProps} from 'sentry/components/onboarding/gettingStartedDoc/sdkDocumentation'; import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step'; import {t, tct} from 'sentry/locale'; // Configuration Start export const steps = ({ dsn, sourcePackageRegistries, }: Partial< Pick > = {}): LayoutProps['steps'] => [ { type: StepType.INSTALL, description: (

{tct('Install the [strong:NuGet] package:', { strong: , })}

), configurations: [ { language: 'shell', partialLoading: sourcePackageRegistries?.isLoading, code: ` # Using Package Manager Install-Package Sentry -Version ${ sourcePackageRegistries?.isLoading ? t('\u2026loading') : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0' } # Or using .NET Core CLI dotnet add package Sentry -v ${ sourcePackageRegistries?.isLoading ? t('\u2026loading') : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0' } `, }, ], additionalInfo: ( {tct( '[strong:Using .NET Framework prior to 4.6.1?] Our legacy SDK supports .NET Framework as early as 3.5.', {strong: } )} ), }, { type: StepType.CONFIGURE, description: (

{tct( 'Initialize the SDK as early as possible, like in the constructor of the [code:App]:', { code: , } )}

), configurations: [ { language: 'csharp', code: ` using System.Windows.Threading; using System.Windows; using Sentry; public partial class App : Application { public App() { DispatcherUnhandledException += App_DispatcherUnhandledException; SentrySdk.Init(o => { // Tells which project in Sentry to send events to: o.Dsn = "${dsn}"; // When configuring for the first time, to see what the SDK is doing: o.Debug = true; // Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. o.TracesSampleRate = 1.0; }); } void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { SentrySdk.CaptureException(e.Exception); // If you want to avoid the application from crashing: e.Handled = true; } `, }, ], }, { type: StepType.VERIFY, description: t('To verify your set up, you can capture a message with the SDK:'), configurations: [ { language: 'csharp', code: 'SentrySdk.CaptureMessage("Hello Sentry");', }, ], }, { title: t('Performance Monitoring'), description: t( 'You can measure the performance of your code by capturing transactions and spans.' ), configurations: [ { language: 'csharp', code: ` // Transaction can be started by providing, at minimum, the name and the operation var transaction = SentrySdk.StartTransaction( "test-transaction-name", "test-transaction-operation" ); // Transactions can have child spans (and those spans can have child spans as well) var span = transaction.StartChild("test-child-operation"); // ... // (Perform the operation represented by the span/transaction) // ... span.Finish(); // Mark the span as finished transaction.Finish(); // Mark the transaction as finished and send it to Sentry `, }, ], additionalInfo: (

{tct( 'Check out [link:the documentation] to learn more about the API and automatic instrumentations.', { link: ( ), } )}

), }, { title: t('Documentation'), description: (

{tct( "Once you've verified the package is initialized properly and sent a test event, consider visiting our [link:complete WPF docs].", { link: ( ), } )}

), }, { title: t('Samples'), description: ( {t( 'See the following examples that demonstrate how to integrate Sentry with various frameworks.' )} {tct( '[link:Multiple samples in the [code:dotnet] SDK repository] [strong:(C#)]', { link: ( ), code: , strong: , } )} {tct('[link:Basic F# sample] [strong:(F#)]', { link: , strong: , })} ), }, ]; // Configuration End export function GettingStartedWithWpf({ dsn, sourcePackageRegistries, ...props }: ModuleProps) { return ; } export default GettingStartedWithWpf; const AlertWithoutMarginBottom = styled(Alert)` margin-bottom: 0; `;