Visual Studio调试子进程启动时

编程入门 行业动态 更新时间:2024-10-10 17:24:29
本文介绍了Visual Studio调试子进程启动时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个WPF应用程序,加载后(一些wcf服务)我正在运行一个子进程(更少的Windows应用程序)。 这两个项目都在我的解决方案。 我希望调试这两个,我知道如果我在多个启动项目下的解决方案属性中设置了动作=启动,我可以调试2个项目。

但是不是这样,因为WPF应用程序在X时间后启动子进程。我不能附加到进程,因为我想抓住子进程的主要方法。

是否有解决方案? 目前为止,我所做的是禁用CreateNewProcess()方法,放置应该发生的断点,并手动调试项目,然后从该断点继续使用WPF应用程序,使用2个视觉工作室。

解决方案

使用调试器设置

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image文件执行选项

as 在本博客文章中描述,使子进程在启动时自动中断。然后,出现提示时,选择您正在使用的Visual Studio实例来调试父进程。

I have a WPF Application, after it is loading (some wcf services) i am running a child process (Gui less Windows Application). Both projects are in my solution. I Wish to debug both of them, I know i can debug 2 projects if i set both of with action = start in the Solution properties under "Multiple startup projects".

But this is not the case, since the WPF app is starting the child process after X time. And i cannot "Attach to process" since i want to catch the main method of the child process.

Is there a solution ? What i did so far was to disable the CreateNewProcess() method, place a break point where it should occur, and manually debug the project, and then continue the WPF app from that break point, using 2 visual studios..

解决方案

Use the debugger settings Registry key under

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options

as described in this blog post to make the child process automatically break on startup. Then, when prompted, choose the Visual Studio instance you're using to debug the parent process.

更多推荐

Visual Studio调试子进程启动时

本文发布于:2023-06-02 00:48:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/430953.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:启动时   进程   Visual   Studio

发布评论

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

>www.elefans.com

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