views:

32

answers:

2

As I step into .NET source (.NET source stepping is enabled in Debugging Options and Just my Code is disabled), for some reason in the Autos and Watch windows in VS2010, I can't view parameters in .NET framework functions in the watch or autos panes. I can see local variables however. Why is this?

Update: This is a debug 64-bit (x64) build with no optimizations. There is no error, I just can't "watch" parameters in functions like:

// Enumerable.cs

public class Lookup<TKey, TElement> : IEnumerable<IGrouping<TKey, TElement>>, ILookup<TKey, TElement>{
...
    internal static Lookup<TKey, TElement> Create<TSource>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) {

Update 2: It seems that by default, only the release build of the .NET 4.0 framework is installed. You can still step into it, but you may not see some function parameters and local variables (and set breakpoints on some lines). What I guess I would really like is to use a Debug build of the .NET 4.0 framework so that I can see all params, locals and put breakpoints on all lines. How do I go about installing this, if I have VS2010 Premium already installed?

+1  A: 

You probably need to disable optimizations.

Edit by Michael Goldshteyn - the question's author:

Here are the full instructions from that URL:

  1. The following environment variable must be set before VS2010 is started:

    set COMPLUS_ZapDisable=1

  2. The VS hosting process must be disabled:

    To disable the hosting process in VS2010

    1.Open a project in Visual Studio.
    2.On the Project menu, click Properties.
    3.Click the Debug tab.
    4.Clear the Enable the Visual Studio hosting process check box.

SLaks
A: 

You may be debugging a release build - check that you are running a debug build. (what you can 'watch' seems to be rather variable in release builds)

Jason Williams