views:

279

answers:

2

The application I'm working does not start in the debugger of Visual Studio 2005.

Here's what I do:

  • I rebuild the application and hit F5 to start it
  • The title of the VS2005-window says "projectname (Running) ..."
  • The debugger buttons appear but are greyed out
  • The application appears in the Windows task manager, but it has only 80k in memory usage
  • Nothing happens for a long while, and finally I get a windows with the following error message: "Debugging is being stopped but is not yet complete. You can force debugging to stop immediately, but any process being detached may be terminated instead. This window will automatically close when the debugging has completely stopped". The window does not disappear, so after a while I press the "Stop now" button.
  • Nothing happens for a while (the debugger buttons still visible, but greyed)
  • Some time later a new window appears: "Unable to start program '(path to exe)'. OLE har skickat en begäran och väntar på svar". The last sentence is swedish for "OLE has sent a request and is waiting for response". I press OK and the debugger buttons are gone.
  • The application is still running, and still has only 80k in memory usage.
  • I try to end the process with the task manager, but it is not killed.
  • I quit Visual Studio and finally the process is gone.

The application is an unmanaged C++ project, that use a lot of DLL-files as plugins. I'm using the "multi-threaded debug" runtime, and I've made sure all dependencies are compiled against the same runtime.

It was while doing that this problem appeared all of a sudden. I've tried to reverse my changes, but it doesn't help. Restarting the computer doesn't help either.

I've got the application running once or twice at random. If I then ended the application and started it again it wasn't started. So I don't think this is because of my configuration.

Any ideas?

One more note: the application starts and runs as it should if I start it from outside Visual Studio.

+1  A: 

Sounds like a misbehaving DllMain() in one of the implicitly linked DLLs used by your program. You might get a hint from the Output window, it lists the names of the DLLs as they get loaded. If it is wininet.dll then you've fallen into a deadlock trap with the symbol server.

Hans Passant
Interesting, but I've now tried to delete all plugins (all DLL's), and the output window is empty.
Jonatan
+1  A: 

Ok, I've solved my problem, but I have no idea how.

One thing i tried was deleting all build files and exe and dll files, and then recompile everything. But that didn't help.

I then tried one thing at random: the plugins were in the same solution. So I removed them and tried to run again. And this time it worked! So I added all the plugin-projects back, and it still works!

So, I guess I will never know what happened. But removing and adding a project to a solution might solve someone elses problem too ... :)

Jonatan
After a few runs I had the problem back. But just removing any project by random from the solution makes it work again!
Jonatan
Even more info: Before this problem appeared I had problems with some DLL-plugins allocating memory with malloc(), that was freed from another DLL with free(). This resulted in an assert error, even though they all use the same runtime. I'm working around this error by supplying a callback to a function that calls malloc().I've not yet fixed every plugin, and it seems this problem appears as soon as I hit that error. And then it is impossible to start the program, even after I've restarted VS2005, until i remove a project ...
Jonatan
Final solution: I trashed my solution-directory, and made a clean checkout. Problem is gone, permanently. Probably some build-file that was corrupt, and that was not removed with the "clean solution" command. I have the old directory intact, in case I want to investigate further.
Jonatan
No matter how many new solutions/projects I create I still cannot run my application. :(
Shiftbit