2

When launching a program from Visual Studio 2012 in debug mode (using the "Play" button), my application fails at a certain line of code. For the sake of being specific, the error I'm receiving is:

Method Open threw an exception. Could not create a service object instance, or could not get its IDispatch interface.

However, when I run the application by simply launching the EXE by clicking on the file name, I do not encounter this error.

Additionally interesting is the fact that I can add the following statement to my code (causing the debugger to attach AFTER launch) and I do not receive the exception I mentioned above.

if(!Debugger.IsAttached) {
    Debugger.Launch();
}

So, in short: When Visual Studio launches my program, there is SOMETHING different about the processes permissions / rights, app domain, or other factor that is changing its ability to operate "normally". I know that the parent process of my application when launched from Visual Studio is the devenv.exe process, could that have anything to do with it?

Some troubleshooting I've done:

  • I have disabled the Visual Studio Hosting Process to eliminate that from being a potential issue.
  • I've inspected the process in each different testing scenario listed above in Sys Internals' Process Explorer. I've compared permissions, session, user name the application was launched under, and many other things to attempt to find a reason why the application would function differently. All comparisons come up identical with the exception of the parent process (explorer.exe when launched manually and devenv.exe when launched through Visual Studio)

Any ideas?

Update:

I did another test and selected Debug -> Start Without Debugging, which DID NOT produce the error specified, but still launched the program with its parent process being devenv.exe which rules out that as being a potential issue. So its something to do with the debugger being attached right from the start of the program.

Ryan Griffith
  • 1,591
  • 17
  • 41
  • Possible duplicate: http://stackoverflow.com/q/16696444/395718 – Dialecticus Jan 05 '14 at 19:47
  • This could be caused by the VS's debug hosting process. Try disabling hosting and running in the debugger again. See [this](http://msdn.microsoft.com/en-us/library/ms185330.aspx) for instructions on disabling it. – Mike Zboray Jan 05 '14 at 20:45
  • Hi @Mikez , you have a good idea, however I've already done that (per my comments above). Any other ideas? – Ryan Griffith Jan 06 '14 at 03:33

0 Answers0