我的程序进入调试模式 [英] my program goes to the debug mode

查看:107
本文介绍了我的程序进入调试模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用int.parse并且我的程序没有运行并进入调试模式

我该怎么办?

我到目前为止我写的很多程序都有这个问题

帮助我们

解决方案

你的程序不会进入调试模式,因为没有像调试模式这样的想法。这根本不是调试器的工作原理。只有从一开始就在调试器下执行它时会发生什么,并且会调用调试器。如果你只是从Shell执行它,还会发生其他事情;它可能取决于你如何处理异常。我可以请求用户开始调试,或者它可能只是通过,或崩溃。一个可能且非常可能的原因是解决方案1中解释的原因。


-SA


可能你没有处理 Parse 方法抛出的异常(可能是错误的格式)。您可以:

  • 明确处理此类异常。
  • 使用TryParse [ ^ ](检查返回值)。


参见,例如什么是更好的:int.TryParse或try {int.Parse()} catchat Stack Overflow [< a href =http://stackoverflow.com/questions/4945763/what-is-better-int-tryparse-or-try-int-parse-catchtarget =_ blanktitle =New Window> ^ ]。

I use int.parse and my program doesn''t run and go to the debug mode
what should I do?
I have this problem on many programs that I have written since so far
help me guys

解决方案

Your program is not going to "debug mode", just because there is no such think as "debug mode". This is simply not how debuggers work. What happens happens only if you execute it under the debugger from the very beginning, and something invokes the debugger. If you just execute it from the Shell, something else will happen; and it may depends on how you handle exception. I may request the user to start debugging, or it may just pass through, or "crash". One possible and very likely reason is the one explained in Solution 1.

—SA


Probably you are not handling an exception (possibly bad format) thrown by the Parse method. You might either:
  • Explicitely handle such exception.
  • Use the TryParse[^] (checking the return value).

See, for instance "What is better: int.TryParse or try { int.Parse() } catch" at Stack Overflow[^].


这篇关于我的程序进入调试模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆