This section shows what happens when an executable throws an exception.
You must have Visual Studio installed to follow these steps. If you don't have Visual Studio, you can download the free Visual Studio 2015 Community Edition.
When you install Visual Studio, Just-In-Time debugging is enabled by default.
For the purposes of this section, we'll make a C# console app in Visual Studio that throws a NullReferenceException.
In Visual Studio, create a C# console app (File / New / Project / Visual C# / Console Application) named ThrowsNullException. For more information about creating projects in Visual Studio, see Walkthrough: Create a Simple Application with Visual C# or Visual Basic.
When the project opens in Visual Studio, open the Program.cs file. Replace the Main() method with the following code, which prints a line to the console and then throws a NullReferenceException: