473,790 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Variable not Showing in Debugger

Can anyone tell me why j never shows up in my locals window? 32 is
printed to console so I know the assignment is working. I was under the
impression that I could see everything as it happens by setting a
breakpoint then F11 on through the code. Kind of disturbing that j never
shows up, (regardless of where I set my breakpoint) as it makes me
wonder what else I'm not seeing. Is there a 'show everything' debugger
option or something I'm missing? BTW, I'm using the 'Express' version of
Visual Studio.

public class Tester
{
* static int j = 32;
static void Main()
* {
Console.WriteLi ne(j);
Time t1 = new Time( currentTime );
t1.DisplayCurre ntTime();

Time t2 = new Time( 2007, 9, 18, 11, 45 );
t2.DisplayCurre ntTime();

Time t3 = new Time();
t3.DisplayCurre ntTime();
}
}

//* = breakpoints

Thanks in advance,

Jack
Aug 13 '08 #1
12 6045
On Aug 13, 12:04*pm, Arcticool <arctic...@hotm ail.comwrote:
Can anyone tell me why j never shows up in my locals window?
...
public class Tester
{
* static int j = 32;
Because it's not a local variable. Local variables are those declared
within a method, and "j" here is a static field. You can type
"Tester.j" in the Watch window to observe it.
Aug 13 '08 #2
On Wed, 13 Aug 2008 01:04:35 -0700, Arcticool <ar*******@hotm ail.com>
wrote:
Can anyone tell me why j never shows up in my locals window?
The static field j isn't a local variable.
32 is printed to console so I know the assignment is working. I was
under the impression that I could see everything as it happens by
setting a breakpoint then F11 on through the code. Kind of disturbing
that j never shows up,
You might try the "Autos" window. It will only show the static field j
when it's present in the previous and current line of code as you step
through in the debugger. But at least you'll see it then. :)

Pete
Aug 13 '08 #3
It's worth noting that in some scenarios some values won't ever appear in the
debugger, even in the watch window. I think it's either static readonly or
consts in certain scenarios.

"Peter Duniho" wrote:
On Wed, 13 Aug 2008 01:04:35 -0700, Arcticool <ar*******@hotm ail.com>
wrote:
Can anyone tell me why j never shows up in my locals window?

The static field j isn't a local variable.
32 is printed to console so I know the assignment is working. I was
under the impression that I could see everything as it happens by
setting a breakpoint then F11 on through the code. Kind of disturbing
that j never shows up,

You might try the "Autos" window. It will only show the static field j
when it's present in the previous and current line of code as you step
through in the debugger. But at least you'll see it then. :)

Pete
Aug 13 '08 #4
On Wed, 13 Aug 2008 08:25:01 -0700, Simon Tamman
<Si*********@di scussions.micro soft.comwrote:
It's worth noting that in some scenarios some values won't ever appear
in the
debugger, even in the watch window. I think it's either static readonly
or
consts in certain scenarios.
I don't have the complete enumeration. But I would say the general rule
is probably that a variable won't show up when it's not really a
variable. Certainly "const" would fall into that category, maybe "static
readonly", and also variables that have been optimized out in a Release
build. Maybe there are other examples too that I haven't thought of.

Pete
Aug 13 '08 #5
Peter Duniho wrote:
On Wed, 13 Aug 2008 08:25:01 -0700, Simon Tamman
<Si*********@di scussions.micro soft.comwrote:
>It's worth noting that in some scenarios some values won't ever appear
in the
debugger, even in the watch window. I think it's either static
readonly or
consts in certain scenarios.

I don't have the complete enumeration. But I would say the general rule
is probably that a variable won't show up when it's not really a
variable. Certainly "const" would fall into that category, maybe
"static readonly", and also variables that have been optimized out in a
Release build. Maybe there are other examples too that I haven't
thought of.

Pete
Hmm, I've looked everywhere that I can think of and I do not see an
'Autos' window. I have Error List, Output, Locals, and Watch. In another
pane I have Call Stack and Immediate. But no Autos.

Also, maybe I'm missing something but it sure seems lame that the
debugger won't show me what's going on automatically. After all isn't
that its job? Having to type Tester.j in the watch window does work, but
what if there are a ton of those, then I have to manually type them all
(?) Just seems like a glaring omission of functionality to me. Can
anyone think of a reason for this. I'm sure I must be missing something.

Jack
Aug 13 '08 #6
On Wed, 13 Aug 2008 13:08:50 -0700, Arcticool <ar*******@hotm ail.com>
wrote:
Hmm, I've looked everywhere that I can think of and I do not see an
'Autos' window. I have Error List, Output, Locals, and Watch. In another
pane I have Call Stack and Immediate. But no Autos.
I don't have an Express version installed on any of my computers right
now, but it would surprise me very much if that was one of the
"retail-only" features.

Are you sure you're looking at the "Debug/Window ->" menu when you're
actually debugging a project. The "Autos" window is only available then.

If all else fails, try typing Ctrl-D, followed immedately by A. That
should show the window.
Also, maybe I'm missing something but it sure seems lame that the
debugger won't show me what's going on automatically.
Your comment doesn't make any sense to me. The debugger has a variety of
ways for you to monitor data automatically, including the "Autos" window.
After all isn't that its job? Having to type Tester.j in the watch
window does work, but what if there are a ton of those, then I have to
manually type them all (?)
If you feel that at every program statement, you have so many different
variables that you need to keep an eye on it's actually problematic for
you to configure the debugger to show you those variables, you probably
have something wrong either with your program's design or your debugging
technique.

Pete
Aug 13 '08 #7
Peter Duniho wrote:
On Wed, 13 Aug 2008 13:08:50 -0700, Arcticool <ar*******@hotm ail.com>
wrote:
>Hmm, I've looked everywhere that I can think of and I do not see an
'Autos' window. I have Error List, Output, Locals, and Watch. In
another pane I have Call Stack and Immediate. But no Autos.

I don't have an Express version installed on any of my computers right
now, but it would surprise me very much if that was one of the
"retail-only" features.

Are you sure you're looking at the "Debug/Window ->" menu when you're
actually debugging a project. The "Autos" window is only available then.
Yep, the Debug/Window only has Output, Locals, Watch, Immediate, and
Call Stack, no Autos present.
If all else fails, try typing Ctrl-D, followed immedately by A. That
should show the window.
No go. Maybe this is where the 'Express' version falls short and you get
what you pay for...
>Also, maybe I'm missing something but it sure seems lame that the
debugger won't show me what's going on automatically.

Your comment doesn't make any sense to me. The debugger has a variety
of ways for you to monitor data automatically, including the "Autos"
window.
Unless it doesn't :)
>After all isn't that its job? Having to type Tester.j in the watch
window does work, but what if there are a ton of those, then I have to
manually type them all (?)

If you feel that at every program statement, you have so many different
variables that you need to keep an eye on it's actually problematic for
you to configure the debugger to show you those variables, you probably
have something wrong either with your program's design or your debugging
technique.

Pete
I just thought that the debugger could show everything that's happening
in the code as you step through. If it is only selectively showing me
information, I wonder what else I'm *not* seeing. Now I'm also wondering
if 'Express' is as good of a learning tool as the other versions...

Jack
Aug 13 '08 #8
In my installation VS Team System 2008 3.5 SP1 the auto Window shortcut is Ctrl+Alt+V,A.
If Express can't show the call stack that would make it unusable for me.
On Wed, 13 Aug 2008 16:34:37 -0700, Arcticool <ar*******@hotm ail.comwrote:
>Peter Duniho wrote:
>On Wed, 13 Aug 2008 13:08:50 -0700, Arcticool <ar*******@hotm ail.com>
wrote:
>>Hmm, I've looked everywhere that I can think of and I do not see an
'Autos' window. I have Error List, Output, Locals, and Watch. In
another pane I have Call Stack and Immediate. But no Autos.

I don't have an Express version installed on any of my computers right
now, but it would surprise me very much if that was one of the
"retail-only" features.

Are you sure you're looking at the "Debug/Window ->" menu when you're
actually debugging a project. The "Autos" window is only available then.

Yep, the Debug/Window only has Output, Locals, Watch, Immediate, and
Call Stack, no Autos present.
>If all else fails, try typing Ctrl-D, followed immedately by A. That
should show the window.

No go. Maybe this is where the 'Express' version falls short and you get
what you pay for...
>>Also, maybe I'm missing something but it sure seems lame that the
debugger won't show me what's going on automatically.

Your comment doesn't make any sense to me. The debugger has a variety
of ways for you to monitor data automatically, including the "Autos"
window.

Unless it doesn't :)
>>After all isn't that its job? Having to type Tester.j in the watch
window does work, but what if there are a ton of those, then I have to
manually type them all (?)

If you feel that at every program statement, you have so many different
variables that you need to keep an eye on it's actually problematic for
you to configure the debugger to show you those variables, you probably
have something wrong either with your program's design or your debugging
technique.

Pete

I just thought that the debugger could show everything that's happening
in the code as you step through. If it is only selectively showing me
information, I wonder what else I'm *not* seeing. Now I'm also wondering
if 'Express' is as good of a learning tool as the other versions...

Jack
Aug 14 '08 #9
On Wed, 13 Aug 2008 16:34:37 -0700, Arcticool <ar*******@hotm ail.com>
wrote:
[...]
I just thought that the debugger could show everything that's happening
in the code as you step through. If it is only selectively showing me
information, I wonder what else I'm *not* seeing.
Well, one other obvious thing missing from Express is the lack of threaded
debugging. That is, you can debug any thread in Express, but it has no UI
for switching your view from one thread to another.

Express is a limited version of Visual Studio. It stands to reason that
there will be things it doesn't show you.
Now I'm also wondering if 'Express' is as good of a learning tool as the
other versions...
If the Express version had all of the features that the retail versions
had, there wouldn't be much point in the retail versions, would there?
And surely the determining factor for what features make it into the
Express version and what features don't is not strictly "which ones
support the IDE as a learning tool?" That is, obviously given that some
features are missing in the Express version, some of the missing features
would be ones that are useful for learning.

In other words, I have no idea why you would expect that the free version
of Visual Studio be every bit as effective a "learning tool" as the retail
version, at least with respect to your apparent implication that features
in the IDE equate to it being a "learning tool" (personally, I think that
one of the things that may help the Express version be a good learning
tool is the relative simplicity, leaving out features that could confuse a
beginning programmer).

Now, all that said...I'm still surprised that it doesn't have the "Autos"
window. I've used the Express version in the past, and that's the sort of
feature that I'd think I'd notice if it were missing. But I guess I'll
take your word for it that that's one of the features that's been left out
of the Express version (I definitely don't care enough to install the
thing now just to check :p ).

But surely this is not a critical feature for being able to use the
debugger as a "learning tool". It's really only a matter of slight
inconvenience. It's not like the debugger won't let you see whatever
variables you want to see. You just need to be a bit more explicit about
it.

Pete
Aug 14 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1685
by: IC | last post by:
Hello, When debugging a SQL sproc in VS.NET, is there a way to get the debugger to retrieve the full value of a SQL variable if its content is longer than 256 characters? I currently have a SQL variable of type TEXT, its content is roughly 1000 characters. When stepping through the sproc in the debugger only 256 character are displayed in the watch windows and same thing with the Immediate Command Window.
6
1151
by: VMI | last post by:
I have a really simple IF statement that looks like this: if (sNewString.Length == iCount) { MessageBox.Show (sNewString.Length.ToString() + " is equal to " + iCount.ToString() + "*" + sNewString + "*"); } if (sNewString.Trim() == "") { MessageBox.Show ("");
4
1508
by: Ryan Gaudet | last post by:
Hi, I'm making some minor changes to a VB 6 app that I converted to VB .NET a couple of years ago and I'm running into an issue with a function that is seemingly returning a different result in the debugger than when I run the exe. The code in question is this; iniFileName = Replace(System.Reflection.Assembly.GetExecutingAssembly.Location, ".exe", "") & ".ini"
0
1176
by: Michael R | last post by:
Here's one that's got me stumped... I have a class with a member variable. I set it in a member method. In the debugger, it shows up as <undefined> before AND AFTER it is set. However, after it is set, I set a property of the newly initialized member. Even though the debugger says that the value is undefined, there is no run-time error. I call another class method and pass the member variable by 'ref'. The
3
2697
by: Vagif Abilov | last post by:
I investigate further the problem I reported earlier as incorrectly set values of static variable instances. Actually it is reproduced with a little piece of code. I made a simlpe Web site consisting of an empty page. The page C# code file looks like this: using System; using System.Web;
4
5946
by: aramsey | last post by:
I have a javascript program that works fine under Firefox and on IE when running XP, but is having a problem with IE running under Windows 2000 Pro. On my personal XP development machine I have the Microsoft Script Editor and I can set a breakpoint, step through code, inspect variables, etc... with no problem. On a machine where I am trying to debug this problem I am running Windows 2000 Pro with IE 6. I installed the Microsoft...
2
1712
by: Joanna Carter [TeamB] | last post by:
Hi folks If I write a KeyDown handler and check the KeyCode for Keys.Insert, the debugger shows the value as Keys.LButton | Keys.MButton | Keys Back | Keys.Space. This is perfectly understandable since Keys.Insert = 45 and 1 + 4 + 8 + 32 also equals 45. However, it would be really nice if the debugger showed both the combined value as well as the Flags attribute split value.
5
2283
by: Max2006 | last post by:
Hi, I am using Visual C# 2005 and I like to setup breakpoint that pause execution upon a class variable change. Is that possible?
3
1380
by: call_me_anything | last post by:
Hi, How do I stop the debugger (ddd or even gdb will do) when a global variable (or a static variable in a function) gets modified ? Adding a watch on the variable only tells that the variable has changed but not how.
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.