Debugging .NET applications
Previous Top Next




How to Debug .NET Applications packaged with Thinstall when .NET Framework is linked

When you run an application pacakged with Thinstall, the following dialog box will appear if the applicaiton throws an unhandled exception.

clip0485

The are three methods for debugging .NET applications running under Thinstall.

Method 1: Install the .NET SDK (different from framework) and use the included cordbg.exe to launch your application

Pictured below is shows the typical process for launching a Thinstall packaged .NET application under cordbg.exe.

1. Run cordbg.exe with the name of your EXE as a command-line argument
2. Type the debugger command "cont" (short for continue)
3. If your application throws an unhandled exception, the exception and call stack will be displayed

clip0484

Note: If you add cordbg.exe to your system path (c:\program files\microsoft.net\sdk\v1.1\bin\cordbg.exe, it will automatically be launched any time your .NET applications crash.


Method 2: Use Thinstall to run cordbg.exe on a "clean" install of Windows

Method 1 requires you to "pollute" the target machine with the .NET SDK & Framework. It may be your intention to diagnose errors that occur for machines where the .NET Framework is not installed. For these cases we have created (using Thinstall) a version of cordbg.exe that does not require the .NET Framework.

You can download this version and associated Thinstall project here:
http://thinstall.com/examples/v11/cordbg.exe
(20MB Stand-alone Debugger, just download and run)
http://thinstall.com/examples/cordbg_v11.zip
(Thinstall project archive with original files, so you can see how we made it)

Simply download cordbg_v11.exe and copy it to your application directory. You can either launch your application as shown in method 1, or you can simply launch your application normally. If your application throws an unhandled exception it will automatically launch cordbg.exe and show you the error.

Method 3: To debug your application using Visual Studio, you need to modify your virtual registry settings


After creating your Thinstall .NET project, you should see a file in the list called framework_version.threg.
Double-click on this file to locate the local path for this file. The local path should be something like c:\program files\thinstall\v1.1.4322\framework_version.threg.

Load your copy of the framework_version.threg file using a text editor such as wordpad.

The 3rd line of the file should read :

value DbgJITDebugLaunchSetting 04 00000000

replace the above line with the following 2 lines:

value DbgJITDebugLaunchSetting 04 02000000
value DbgManagedDebugger 01 "#22C:\Program Files\Common Files\Microsoft Shared\VS7Debug\vs7jit.exe#22 PID #25d APPDOM #25d EXTEXT #22#25s#22 EVTHDL #25d"

If you have Microsoft Developer Studio installed in a different location, you may need to edit the path to vs7jit.exe.

Now rebuild your application and run it. If the application crashes or throws an unhandled exception, the JIT debugger will be loaded and you will be provided with exceptions that occur. Note: you will not be able to step through your program at the source level - but you can see the call stack and exception information.