变量未在调试器中显示

编程入门 行业动态 更新时间:2024-10-19 22:42:45
本文介绍了变量未在调试器中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有谁能告诉我为什么j永远不会出现在我的本地窗口? 32是 打印到控制台,所以我知道作业正在运行。我在 的印象中,通过设置一个 断点,然后通过代码设置F11,我可以看到所有内容。有点令人不安的是j永远不会出现,(无论我在哪里设置我的断点),因为它让我想起了什么,我想知道还有什么我没看到的。是否有''显示一切''调试器 选项还是我缺少的东西?顺便说一下,我正在使用 Visual Studio的''Express'版本。 公共类测试员 { * static int j = 32; static void Main() * { Console.WriteLine( j); 时间t1 =新时间(当前时间); t1.DisplayCurrentTime(); 时间t2 =新时间(2007,9,18,15,45); t2.DisplayCurrentTime(); 时间t3 =新时间(); t3.DisplayCurrentTime(); } } // * =断点 在此先感谢, 杰克

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.WriteLine(j); Time t1 = new Time( currentTime ); t1.DisplayCurrentTime(); Time t2 = new Time( 2007, 9, 18, 11, 45 ); t2.DisplayCurrentTime(); Time t3 = new Time(); t3.DisplayCurrentTime(); } } //* = breakpoints Thanks in advance, Jack

推荐答案

8月13日, 12:04 * pm,Arcticool< arctic ... @ hotmailwrote: On Aug 13, 12:04*pm, Arcticool <arctic...@hotmailwrote: 谁能告诉我为什么j永远不会出现在我的本地窗口? ... 公共类测试员 { * static int j = 32; Can anyone tell me why j never shows up in my locals window? ... public class Tester { * static int j = 32;

因为它不是局部变量。局部变量是在方法中声明为 的变量,而j是这是一个静态字段。您可以输入 " Tester.j"在Watch窗口观察它。

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.

2008年8月13日星期三01:04:35 -0700,Arcticool< ar ******* @ hotmail > 写道: On Wed, 13 Aug 2008 01:04:35 -0700, Arcticool <ar*******@hotmail> wrote: 谁能告诉我为什么j永远不会出现在我的本地窗口? Can anyone tell me why j never shows up in my locals window?

静态字段j不是局部变量。

The static field j isn''t a local variable.

32打印到控制台所以我知道任务正在发挥作用。我的印象是,我可以看到所有的一切,因为它发生了 设置一个断点然后通过代码F11。有点令人不安的 ,j从不出现, 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,

您可以试试Autos窗口。当你在调试器中执行时,它只会显示静态字段j 当它出现在前一行和当前代码行中时。但至少你会看到它。 :) Pete

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

值得注意的是,在某些情况下,某些值不会出现在 调试器,即使在观察窗口中也是如此。我认为它在某些情况下是静态只读或 。 Peter Duniho写道: 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: 2008年8月13日星期三01:04:35 -0700,Arcticool< ar ******* @ hotmail> 写道: On Wed, 13 Aug 2008 01:04:35 -0700, Arcticool <ar*******@hotmail> wrote: 有谁能告诉我为什么j永远不会出现在我的本地窗口? Can anyone tell me why j never shows up in my locals window?

静态字段j不是局部变量。

The static field j isn''t a local variable.

32打印到控制台所以我知道任务正在发挥作用。我的印象是,我可以看到所有的一切,因为它发生了 设置一个断点然后通过代码F11。有点令人不安的 ,j永远不会出现, 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,

您可以试试Autos窗口。当你在调试器中执行时,它只会显示静态字段j 当它出现在前一行和当前代码行中时。但至少你会看到它。 :) Pete

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

更多推荐

变量未在调试器中显示

本文发布于:2023-11-28 16:39:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643164.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   器中

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!