This project is read-only.

Attach to process running in Visual Studio

Mar 14, 2011 at 12:48 PM

Hi Christian.

I like WPF Inspector. It seems really useful. I have situations where I need to ascertain why certain visual elements are behaving strangely and this tool seems perfect for the job.

Yet, most of the time I am developing, I run my WPF applications through the Visual Studio Debug. In this situation, WPF Inspector does not seem to "find" my WPF Application and so I cannot attach to it.

Is it because Visual Studio is already attached to it, or because it is running in the context of the Visual Studio debug?

Is there any way to work around this limitation?

Thank you.

João Paulo Menezes

Mar 14, 2011 at 8:56 PM
Edited Mar 14, 2011 at 8:57 PM

Hi Paulo,

This seems to be a bug. I often attach to an application that is running in the Visual Studio debugger.

Can you tell me a bit more about your environment. What Version of OS, .NET and Visual Studio are you using?

Maybe you can download the sources and step through the code to see where it fails to detect the process.

The processes are detected by enumerating through all windows of your system and see if the process behind has a WPF module loaded (PresentationCore, PresentationFramework, etc)
If you try to debug it, you can start with ManagedApplicationsService.GetManagedApplications() 

I hope this helps.

Thanks for the feedback.
Christian

Mar 15, 2011 at 11:50 AM

Hello again Christian,

I found out what the problem was :)

I usually run Visual Studio as Administrator and I was running WPF Inspector as a normal user. That was why it wasn't able to find the process. I ran WPF Inspector as Administrator and all went well :)

If you still care to know, my environment:

Windows 7 Enterprise x64 SP1

Visual Studio 2010 Premium SP1

.NET Framework 4.0

Maybe one of this days I'll try the source code, just out of curiosity ;)

Keep up the good work!