BASIC DEBUGGING TASKS in VS .NET

Print Quick Response Code in VS .NET BASIC DEBUGGING TASKS
3 BASIC DEBUGGING TASKS
QR-Code Drawer In Visual Studio .NET
Using Barcode generation for .NET framework Control to generate, create QR Code image in .NET framework applications.
3
QR Code ISO/IEC18004 Reader In .NET Framework
Using Barcode decoder for .NET Control to read, scan read, scan image in VS .NET applications.
Basic Debugging Tasks
Painting Bar Code In VS .NET
Using Barcode printer for VS .NET Control to generate, create barcode image in VS .NET applications.
Next, we pick out the first argument to the RaiseTheExceptionInternalOnly function (0x01283cac) and use the DumpObj command with that address to display the managed exception:
Recognize Barcode In .NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in VS .NET applications.
0:000> !DumpObj 01283cac Name: SystemArgumentException MethodTable: 7910139c EEClass: 79101324 Size: 76(0x4c) bytes (C:\WINDOWS\assembly\GAC_32\mscorlib\2000__b77a5c561934e089\mscorlibdll) Fields: MT Field Offset Type VT Attr Value Name 790f9244 40000b5 4 SystemString 0 instance 00000000 _className 79107d4c 40000b6 8 ectionMethodBase 0 instance 00000000 _exceptionMethod 790f9244 40000b7 c SystemString 0 instance 00000000 _exceptionMethodString 790f9244 40000b8 10 SystemString 0 instance 01283cf8 _message 79112734 40000b9 14 tionsIDictionary 0 instance 00000000 _data 790f984c 40000ba 18 SystemException 0 instance 00000000 _innerException 790f9244 40000bb 1c SystemString 0 instance 00000000 _helpURL 790f8a7c 40000bc 20 SystemObject 0 instance 01283d54 _stackTrace 790f9244 40000bd 24 SystemString 0 instance 00000000 _stackTraceString 790f9244 40000be 28 SystemString 0 instance 00000000 _remoteStackTraceString 790fdb60 40000bf 34 SystemInt32 0 instance 0 _remoteStackIndex 790f8a7c 40000c0 2c SystemObject 0 instance 00000000 _dynamicMethods 790fdb60 40000c1 38 SystemInt32 0 instance -2147024809 _HResult 790f9244 40000c2 30 SystemString 0 instance 00000000 _source 790fcfa4 40000c3 3c SystemIntPtr 0 instance 0 _xptrs 790fdb60 40000c4 40 SystemInt32 0 instance -532459699 _xcode 790f9244 40001e5 44 SystemString 0 instance 00000000 m_paramName
Generate QR Code ISO/IEC18004 In C#
Using Barcode creation for VS .NET Control to generate, create QR Code 2d barcode image in .NET applications.
From the output of DumpObj, we can get all the information we need about the managed code exception including the type of exception (ArgumentException) and all the fields associated with the exception (stack trace, message, HRESULT, parameter name, etc) We can further use the DumpObj command on the message field to find out the exception message:
Paint QR In .NET
Using Barcode drawer for ASP.NET Control to generate, create QR Code 2d barcode image in ASP.NET applications.
0:000> !DumpObj -nofields 01283cf8 Name: SystemString MethodTable: 790f9244
QR Code ISO/IEC18004 Encoder In Visual Basic .NET
Using Barcode printer for Visual Studio .NET Control to generate, create QR Code JIS X 0510 image in .NET applications.
Object Inspection
Bar Code Encoder In .NET Framework
Using Barcode drawer for VS .NET Control to generate, create barcode image in VS .NET applications.
EEClass: 790f91a4 Size: 54(0x36) bytes (C:\WINDOWS\assembly\GAC_32\mscorlib\2000__b77a5c561934e089\mscorlibdll) String: Obj cannot be null
USS-128 Maker In Visual Studio .NET
Using Barcode generator for .NET Control to generate, create UCC-128 image in .NET framework applications.
Although dumping exceptions using the DumpObj command is a feasible approach, the DumpObj command can be a bit noisy Most of the time, all we want to display about an exception is the type of the exception, the stack traces (including the internal stack trace), and the message Fortunately, the SOS debugger extension includes a command called PrintException The PrintException command takes the address to the managed exception and prints out the exception information in a more digestible fashion If we were to use the same exception address as previously used (0x01283cac), the PrintException command would display the following:
Creating ANSI/AIM Code 128 In .NET
Using Barcode creator for VS .NET Control to generate, create Code 128C image in .NET framework applications.
0:000> !PrintException 01283cac Exception object: 01283cac Exception type: SystemArgumentException Message: Obj cannot be null InnerException: <none> StackTrace (generated): SP IP Function 0013F430 00CB0483 AdvancedNETDebugging3 ObjTypesThrowException(AdvancedNETDebugging3ObjTypes) 0013F444 00CB0133 AdvancedNETDebugging3ObjTypesMain(SystemString[]) StackTraceString: <none> HResult: 80070057
Encoding GS1 - 13 In VS .NET
Using Barcode creator for VS .NET Control to generate, create EAN-13 image in Visual Studio .NET applications.
Another command that is useful when investigating exceptions is the Threads command, which displays information about each managed thread in the system including the last exception that was thrown by that thread If we ran the Threads command in the previous debug session, we would see the following:
Create Code11 In VS .NET
Using Barcode generation for .NET Control to generate, create Code 11 image in VS .NET applications.
0:000> !Threads ThreadCount: 2 UnstartedThread: 0 BackgroundThread: 1 PendingThread: 0 DeadThread: 0 Hosted Runtime: no ID OSID ThreadOBJ Exception State PreEmptive GC Alloc GC Context Domain Lock Count APT
Drawing European Article Number 13 In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create EAN13 image in ASP.NET applications.
3 BASIC DEBUGGING TASKS
Code 3/9 Drawer In Visual C#
Using Barcode generator for .NET Control to generate, create Code39 image in Visual Studio .NET applications.
3
Bar Code Drawer In Java
Using Barcode maker for Java Control to generate, create barcode image in Java applications.
Basic Debugging Tasks
Generating ANSI/AIM Code 128 In VB.NET
Using Barcode creator for Visual Studio .NET Control to generate, create Code-128 image in Visual Studio .NET applications.
0 1 a0c 00190d50 a020 Enabled SystemArgumentException (01283cac) 2 2 580 0019aa88 b220 Enabled (Finalizer)
Creating Barcode In Java
Using Barcode generation for Java Control to generate, create bar code image in Java applications.
00000000:00000000 0015bf28
Code-39 Creation In .NET
Using Barcode creation for ASP.NET Control to generate, create Code-39 image in ASP.NET applications.
00000000:00000000 0015bf28
Encode Barcode In Visual Studio .NET
Using Barcode drawer for ASP.NET Control to generate, create barcode image in ASP.NET applications.
0 MTA
UCC - 12 Maker In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create GS1 128 image in ASP.NET applications.
0 MTA
Here, we can see that the managed thread with an ID of 1 threw a
SystemArgumentException
The last exception command of interest is the StopOnException command Although it is not strictly speaking related to dumping out information about a specific exception, it lets you set a breakpoint when a specific exception is thrown The syntax for the StopOnException is shown in the following:
!StopOnException [-derived] [-create | -create2] <Exception> [<Pseudo-register number>]
The create and create2 switches control whether you want the breakpoint to hit on a first or second chance occurrence of the specified exception The derived option increases the scope of the breakpoint to include not only the exception specified but also any of the exceptions that are derived from the specified exception The pseudo-register is optional and indicates which pseudo register the command will use to set the breakpoint If no pseudo register is specified, it will default to $t1 Let s look at some examples If we want to set a breakpoint when a first chance SystemArgumentException is thrown, we can use the following command: