locked
how to start external program one time when you debug dll RRS feed

  • Question

  • when i debug dll using vs 2010 c#, can let vs start external program one time or don't start external progame if vs found external program running. Beacause my external program need long time to start.
    Monday, December 10, 2012 5:51 PM

Answers

  • You can configure VS to start a program other than the project being debugged via the Debug project settings.  But stopping the debugger and restarting it is going to probably start the program again.  So, in general, you aren't going to get around the long startup time of your app.  It might be better to resolve the issue by adjusting your application's load process.  Lazy loading of data and asynchronous programming can speed up the startup of your app.  Refer to MSDN and Google on how to speed up your app load.

    Michael Taylor - 12/10/2012
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Lisa Zhu Wednesday, December 12, 2012 7:51 AM
    • Marked as answer by Lisa Zhu Thursday, December 20, 2012 7:10 AM
    Monday, December 10, 2012 6:14 PM

All replies

  • You can configure VS to start a program other than the project being debugged via the Debug project settings.  But stopping the debugger and restarting it is going to probably start the program again.  So, in general, you aren't going to get around the long startup time of your app.  It might be better to resolve the issue by adjusting your application's load process.  Lazy loading of data and asynchronous programming can speed up the startup of your app.  Refer to MSDN and Google on how to speed up your app load.

    Michael Taylor - 12/10/2012
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Lisa Zhu Wednesday, December 12, 2012 7:51 AM
    • Marked as answer by Lisa Zhu Thursday, December 20, 2012 7:10 AM
    Monday, December 10, 2012 6:14 PM
  • If you have another program you need to have running when you are debugging externally, but its load is something you don't want to have done unless it isn't running, then consider writing a bootstrapper.

    i.e. Write another program that launches your target program if its not running. It's only a couple of lines of code to do.

    psuedo:

    if(!(FindProcesssName("myapp.exe")) Process.start("Myapp.exe");

    Now, have VS launch that one.

    Really though, if you are debugging a DLL, unless you restart the application, you won't be getting the newly built DLL loaded into memory. The EXE using it will have already loaded it, and have a lock on it. DLL Debugging normally requires you to kill the application that loads it(quit it) before you rebuild and run. Attaching to the program with a debugger on start is the usual practice, and terminating the debugger normally will kill the app for you.

    Thursday, December 13, 2012 1:39 PM