devxlogo

Control what happens when an unhandled exception occurs

Control what happens when an unhandled exception occurs

By default, when an unhandled exception occurs in a managed application, a dialog box appears that asks you whether you want to debug the application with one of the debuggers that are listed in a listbox. (Notice that Windows Forms applications display a different dialog box.)

The behavior of the .NET framework in this case can be controlled by changing the DbgJITDebugLaunchSetting value following registry key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework

This value can be assigned one of the following three values:0 – a simple message box appears and asks the end user whether to Continue or to Attach a debugger. In the former cases a stack dump is produced and the application terminates. In the latter case the debugger listed in the DbgManagedDebugger registry key is lauched.

1 – the application is terminated and a stack dump is produced.

2 – the debugger listed in the DbgManagedDebugger registry key is lauched.

See also  Comparing different methods of testing your Infrastructure-as-Code
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist