Attempting to retrieve a Windows process name causes Access Violation Exception.
The code snippet below is supposed to retrieve the parent that launched my application and display it. It can be explorer or any other Process through which my application is launched. Actually, this code works. Problem is, while Release works, Debug can't get past the searchById line.
This used to work in debug too. I made some additions to my application's code (completely irrelevant as to the code above) and one day, suddenly, I can no longer debug my code. An image of the error is also attached.
Someone, please save my sanity.
10 Replies
when you get to that point is
searchById
null or not?it's null
and so then did you check processId?
process id is not null
checked task manager, processId is my app's id, trying to launch
through debug
so at this point i would use wmi explorer to look at the wmi data and process explorer to double check that there is a parent
since it's debug, shouldn't it be devenv.exe?
hmm i wouldn't be that sure, there are two command for launching a process, launch with debug and without attaching, and also maybe it differs with project type (like if you have a console or something else)