For the complete documentation index, see llms.txt. This page is also available as Markdown.

MyDotNetFrameworkWpfCrasher (.NET Framework)

Testing .NET Framework crashes, hangs, and handled exceptions with the sample WPF application 'MyDotNetFrameworkWpfCrasher'

Before you enable BugSplat in your .NET Framework application, you may want to take a moment to experiment with our MyDotNetFrameworkWpfCrasher sample, a WPF (.NET Framework 4.7.2) app with a button for each kind of report BugSplat for .NET sends.

To get started, clone my-dotnet-crasher, where the sample installs BugSplat from the BugSplat NuGet package. You can also download the BugSplat SDK for .NET and unzip it.

  1. Open MyDotNetFrameworkWpfCrasher.sln with Visual Studio 2022+.

  2. Set your database in Samples\MyDotNetFrameworkWpfCrasher\App.xaml.cs (App.Database), and optionally App.AppName and App.Version.

  3. Create a Client ID and Client Secret pair for your BugSplat database on the Integrations page.

  4. Create a file Samples\MyDotNetFrameworkWpfCrasher\Scripts\env.ps1 and populate it with the following (being sure to substitute your your-client-id and your-client-secret values from the previous step):

$BUGSPLAT_CLIENT_ID = "your-client-id"
$BUGSPLAT_CLIENT_SECRET = "your-client-secret"
  1. Build the solution for x64. A post-build step uploads the sample's executable, DLLs, and .pdb files to BugSplat, so its crashes show file names and line numbers. The solution also builds MyDotNetCrasherNative, the small C++ library the Mixed-Mode and Heap Corruption buttons call into.

  2. Run the sample outside of the Visual Studio debugger (Ctrl+F5). This is important since the debugger interferes with BugSplat's exception handling.

  3. Click a button:

Button
What it does

Crash

Throws an unhandled exception on the UI thread. BugSplat captures a minidump and shows its crash dialog.

Non-Crash Error

Catches an exception and reports it with BugSplat.Post. The app keeps running.

User Feedback

Sends a note with BugSplat.PostFeedback and shows the resulting report id.

Hang

Freezes the UI thread until BugSplat's hang detection reports the hang (within about 10 seconds) and ends the app.

Mixed-Mode Crash

Calls into C++ code that crashes, so the report has one call stack that crosses from C# into C++.

Heap Corruption

Calls into C++ code that frees the same memory twice. Windows fail-fasts the app through Windows Error Reporting, so this button is disabled until BugSplatWer.dll is registered (see below).

  1. When the crash dialog appears, enter some descriptive text to help you identify the crash and click Send report.

  2. Navigate to the BugSplat Dashboard and click the link in the ID column to view details about your crash, including the full symbolicated call stack and various crash metadata.

Heap Corruption and Windows Error Reporting

Heap corruption bypasses the application's exception handlers, so BugSplat captures it through its Windows Error Reporting helper, BugSplatWer.dll, which Windows loads only when its path is in the registry. From an elevated prompt, register the copy next to the sample's executable, then restart the sample:

Until the entry exists, the Heap Corruption button is dimmed, and hovering over it explains why.

Finally, explore how each button is implemented in the sample's source code, and see BugSplat for .NET to integrate BugSplat into your own application.

Last updated

Was this helpful?