代码仅在调试器中执行 - MS Visual C#

发布于 2024-07-10 14:53:48 字数 561 浏览 8 评论 0原文

我正在使用 Microsoft Visual C# 2008 Express Edition。 (我很抱歉 - 这更像是 MS Vis C# 可用性问题,而不是严格的编程问题......)

我写了一个小程序。 当我使用调试器在 MS VC# 中运行它时,一切都很好。 当我使用“单击一次”生成要部署的内容时(我使用“从 CD-ROM”选项而不是“从网站”),然后将其安装在我的计算机(或另一台计算机)上一切都很好,除了一段代码没有运行!

未运行的代码是 try/catch 循环的“catch”部分,我知道它会在应用程序中生成异常。 ,这在独立的已发布应用程序中不起作用。

我可以测试这个捕获,并要求用户在调试器中将

数据发送回我 我正在运行“快速版”,因为一位朋友提到我可能遇到部署“问题”,并且快速版似乎在部署选项方面受到限制,也许标准版就是我所需要的......(因为我可以使用 Windows Installer 而不是“单击一次”发布方法,

是否有意义?

-Adeena

这 (一位老命令行 unix C++ 程序员正在努力理解这个 Microsoft“视觉”世界)

I'm using Microsoft Visual C# 2008 Express Edition. (And I apologize - this is more of a MS Vis C# usability question than a strict programming question...)

I wrote a little program. when I run it in MS VC# with the debugger, all is well. When I use the "click Once" to generate something to deploy (I'm using the "from a CD-ROM" option as opposed to "from a website) , and then I install it on my machine (or a different machine) and all is well except a piece of the code doesn't run!

The code that isn't running is the "catch" part of a try/catch loop. I intentionally have a bug I know generates an exception still in the application so I can test this catch. The catch brings up a GUI and asks the user to send data back to me. In the debugger - this works fine. In the standalone, published app, this doesn't work.

any ideas?

I point out that I'm running the "Express edition" because a friend mentioned that I might have a deployment "issue" and it appears that the Express Edition is limited in deployment options and that maybe the Standard edition is what I need... (since I can use Windows Installer instead of the "click once" publish method).

Does any of this make sense?

Appreciate the help!

-Adeena
(an old command line unix C++ programmer who's struggling to make sense of this Microsoft "Visual" world)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自找没趣 2024-07-17 14:53:48

这段代码是否在表单的构造函数/OnLoad 中? 有/没有调试器之间在这方面存在已知的差异。 修复方法通常是将代码推迟到 UI 线程处理事件为止。 例如:

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        BeginInvoke((Action)LoadStuff);
    }
    void LoadStuff()
    {
        // todo...
    }

Is this code in the constructor/OnLoad of a form, by any chance? There are known differences in this area between with / without debugger. The fix is usually to defer the code until the UI thread is processing events. For example:

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        BeginInvoke((Action)LoadStuff);
    }
    void LoadStuff()
    {
        // todo...
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文