Cannot connect to process in .net 4.0

Message

** has been edited, more details below

I just watched two great videos about Advanced Dotnet Debugging (Brian Rasmussen), and I'm trying to repeat some steps, but just don't know how to continue the tis error:

An attempt to set a processes DebugPort or ExceptionPort was made, but a port already exists in the process. 

I found several answers on google, and I generally understand what it says about the error, but I just don’t understand one strange fact: when I compile my simple application <.NET 4.0, I can connect, as the movie shows, trying to do the same after I compile the target .NET 4.0 application, it disables the installation.

One Google answer says, "Try connecting with windbg using non-invasive mode," but .. Brian does not use any such flags. He just works on his videos.

What's the difference? Where is the catch? Is it Windows 7 vs Vista? Maybe some compilation settings matter?

I am using MS VS 2k10 with MS SDK with Windbg x86 downloaded from msdn and characters correctly configured for http server. The system is MS Vista x86.

Resources (exact time> = 8:15): http://channel9.msdn.com/posts/MDCC-TechTalk-Advanced-NET-Debugging-part-2

Edit: An error is displayed when connecting to a process that was launched from VS. When trying to connect to a process that was started / outside VS, windbg shows no content.

Edit2: Windbg had some lighting problems on my system. Using several times the "menu item" Windows \ [Undock | Dock all] ", I was able to see the contents of the attached process, which was not there.

So now the only question is: what is the difference when connecting to a process launched from VS when it is compiled once using target <4.0 and again = 4.0? Why, when configuring 4.0 windbg, you cannot connect to the process in non-invasive mode. What has changed in VS 2k10?

+6
windbg sos
source share
1 answer

I believe that you are debugging Visual Studio (F5) and then trying to connect. You can only have one active debugger at a time, so you get this error. If you want to start a process from VS, start it without debugging (Ctrl-F5). If you do, you can connect to WinDbg.

EDIT . Sorry, I missed the point that different versions of .NET behave differently in this regard, so let me try to solve your questions again. The reason it "just works" in the video is because I use non-debugging launch every time I launch VS. Therefore, if you just want to follow the examples in the videos, all you need to do is run without debugging.

I started using WinDbg / SOS on CLR2 and x86. Running the x86.NET process from VS back will result in an error, so I'm used to just starting without debugging.

However, as you have discovered, there are scenarios in which you can actually attach a process that is being debugged by VS. I can reproduce the scripts you described, but I can also connect to the x64, .NET 2 process that started with debugging with VS2008, but I cannot connect to the same process if the platform is installed on x86.

Apparently, there are subtle differences that I did not know about, and it seems that this is not related exclusively to the .NET version, since I can connect to the x64.NET2 process, even if it is under the control of the VS debugger.

I will update my answer if I find more information.

+8
source share

All Articles