none
debugging not auto stop when application closed RRS feed

Все ответы

  • Hi,
    I think you have running threads when you close the application.

    --
    Best Regards / Viele Grüße
    Peter Fleischer (former MVP for Developer Technologies)
    Homepage, Tipps, Tricks

    21 августа 2019 г. 18:50
  • Hi Peter. Thanks for replay.

    Do you have idea how to fix the problem?

    21 августа 2019 г. 23:16
  • Hi  zleug,

    WPF application runs in a single process. It may start several threads though.

    Closing a particular window does not terminate this window's thread dispatcher, so the thread keeps running even after closing the window, the process will not close. The solution to this is that mark the thread as background thread.  

    Thread thread = new Thread(() => { /* do something */ });
                thread.IsBackground = true;
                thread.Start();
    
    You should also be able to call Environment.Exit(0) to terminate the process: 
     
    The following solution may helpful for you.

    How to gracefully close WPF application with background tasks running?

    Best regards

    Yong Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    22 августа 2019 г. 6:01
    Модератор
  • Hi Yong Lu. Thanks for replay.

    Please, can you explain where and how to use that code?

    Thanks.

    22 августа 2019 г. 14:17
  • Hi Yong Lu. Thanks for replay.

    Please, can you explain where and how to use that code?

    Thanks.


    Hi    zleug,

    You can use it when you create your thread and close your windows or application.

    As we suggested above, you need to try it yourself and do some searching.

    Besides,  when you post question you  need include all necessary code snippets for anyone else to be able to reproduce your issue from scratch along with a detailed description about the results including any exception messages.
     
    Thank you for your understanding.


    Best regards

    Yong Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    23 августа 2019 г. 7:14
    Модератор
  • I don't have specific code. When I started to develop that project VS worked us usual. When last window was closed debugging stop automatically. My project binding to the same database. But now when I close last window the debugging process don't stop automatically I must to do it manually.

    Thanks.



    • Изменено zleug 23 августа 2019 г. 16:01
    23 августа 2019 г. 14:07
  • you could attach again with debugger to the still running process and see what it is executing.

    But now as you say it: in the last days I too have seen my WPF process continuing to run after debugging: detectable by the rebuild failing as it can not replace the assemblies.
    I simply stopped the proces via Taskamanger, but should perhaps try to debug this.
    VS 2019 on Windows 10 1709.
    23 августа 2019 г. 16:47
  • Hi,

    I had the same problem with VS 2015 and some Windows 10 version. I think it was after updating to 1709. Each start of debugging my C# UWP application did not end. That means it took up to 2 minutes until it finally ended. I deleted the virtual machine and returned to the previous version of Windows 10. I skipped 1709. With 1803 it worked better.

    Best Regards,

    Heiko

    24 августа 2019 г. 20:07