NetInverse Developers Blog

March 10, 2009
Category: Visual Studio — Tags: — admin @ 11:38 pm

Debug Into .NET Framework Library

The source code of the .NET Framework libraries, and debugging support of them with Visual Studio 2008 is now available. Specifically, you can now browse and debug the source code for the following .NET Framework libraries:

  • .NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, etc).
  • ASP.NET (System.Web, System.Web.Extensions)
  • Windows Forms (System.Windows.Forms)
  • Windows Presentation Foundation (System.Windows)
  • ADO.NET and XML (System.Data and System.Xml)You can check out Shawn Burke’s “Configuring Visual Studio to Debug .NET Framework Source Code” for detailed steps. LINQ, WCF and Workflow will become available soon.

Include Line Number in StackTrace

How to make the StackTrace include line number? compile your code in debug mode and deploy the .pdb file along with the assembly.

Set Breakpoints on Optimized Code

CLR has an issue: when JIT compiling optimized code, the mapping between x86 and IL is not kept. Thus when you attach the debugger to a process running optimized code, you may often not be able to set break points. To work around this issue, you can launch the application under the debugger rather than attach to it. When optimized code is JIT compiled when a debugger is present, the x86 to IL map is preserved. You can also create .ini file per assembly that tells the JIT compiler to generate the map. See this MSDN topic: Making an Image Easier to Debug.

Also, if your code is a C++/CLI mixed mode assembly, you may want to disable the option called Enable Just My Code under the tools/Options/Debug.

Debug Into Native Code

To debug into native code when calling a (PInvoke) native function, you need to go to Project->Properties, and make sure Enable Unmanaged Debugging is checked.

Execute permission denied on object ’sp_sdidebug’

If you are debugging a W3Wp process of a Web Service that executes some SQL stored procedures in SQL server 2000, you may get a SQL exception “Execute permission denied on object ’sp_sdidebug’ , database ‘master’, owner ‘dbo’”. To solve it, you can simply just select “Managed Code” only and not select “T-SQL” when you try to attach the process.

Vertical Selection and Copy&Paste

This is a very convenient feature allows you to choose multiple columns and copy/paste them. What you need to do is press and hold the Alt key down first, then press the left mouse key down, drag the highlight towards to the right side to choose columns, and then move mouse downward to select rows.

visualstudiocopypasttip

Force the Solution Explorer highlights the file you are working on

In Visual Studio, whenever you view a file in the main editor, the Solution Explorer would find and highlight that file for you.

  1. Navigate to Tools -> Options
  2. Select “Projects and Solutions” in the tree view on the left
  3. Select “Track Active Item in Solution Explorer

CodeRush Xpress for C# - Free

Developer Express and Microsoft are proud to announce a new version of CodeRush licensed exclusively for C# developers working in Visual Studio. The new product is called CodeRush Xpress, and it includes a fresh selection of hand-picked features taken from CodeRush and Refactor! Pro. It has following major features.

  • Editor Features
  • Navigation Features
  • TDD - Declaration from Usage
  • Refactorings - like Resharper

Visual Studio Debugger Tips and Tricks

The Visual Studio Debugger provides a slew of features that make the task of debugging both easier and more efficient. Learn about time-saving tips and tricks for all versions of the Visual Studio Debugger, including the new debugger features in Visual Studio 2010. Hear about the new mixed-mode debugging feature, the breakpoints window enhancements, the new WPF visualizers, and a number of other features. Also learn about thread debugging enhancements, new features for making stepping into properties easier, and more. Join us as we crack open the toolbox and walk through some of the debugger’s best practices.

Execution Control
- Step filtering for managed
Breakpoints
Symbols
Symbol search:
Path specified by: HKLM/HKCU
Software\Microsoft\VisualStudio\MSPDB\SymbolSearchPath
On the path at any of these
_NT_ALT_SYMBOL_PATH
_NT_SYMBOL_PATH
SystemRoot
Multi-threaded debugging
Post mortem debugging

Visual Studio Debugger Tips and Tricks

Visual Studio Debugger Tips and Tricks

http://channel9.msdn.com/pdc2008/TL59/

How to Config Visual Studo to Debug .Net Source Code

http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx

©2009 NetInverse. All rights reserved. Powered by WordPress