1

We wrote a wpf application using .NET 3.5. We use the CANopen protocal and log4net. The application starts a few tasks all of which are completed. I checked this by writing a message to the log file - everything was ok. Sometimes the application process terminates immediatelly, sommetimes it takes a few seconds and sometimes it does not terminate. Any ideas what could cause this?

Florian Schaal
  • 2,586
  • 3
  • 39
  • 59
MrToast
  • 1,159
  • 13
  • 41
  • 2
    This seems like way too little to go off of, well, at least for me... – H.B. Jun 22 '16 at 12:31
  • The non-determinism might have to do with garbage collection, as in the lack of garbage collection happening keeping the application alive. – H.B. Jun 22 '16 at 12:32
  • Possible duplicate of [WPF Application still runs in background after closing](http://stackoverflow.com/questions/3543704/wpf-application-still-runs-in-background-after-closing) – Vishnu Prasad V Jun 22 '16 at 12:32
  • Can you reproduce this within or attach a debugger? You should then be able to see which thread is keeping the process open. – Ben Jackson Jun 22 '16 at 12:35
  • @H.B.: What can i do in this case? – MrToast Jun 22 '16 at 12:49
  • `GC.Collect()` forces garbage collection, but do you know when to trigger that, i.e. when all tasks are done? – H.B. Jun 22 '16 at 12:55
  • You can use tools for getting state of threads and executing methods. Here is my tool - https://github.com/REASY/ProcInfo4Net. Usage is simple: ProcInfo4Net.exe ###ProccessId### – Artavazd Balayan Jun 22 '16 at 13:55

0 Answers0