locked
CLR exception in .NET managed code RRS feed

  • Question

  • Hello everyone,

    I am having trouble with my .NET WPF application on one specific pc (with 4 CPU core units): A couple of seconds after my application hast started, I run into a System Engine Exception, I tried to look into the issue with WinDbg and got some of these exception messages:

    o GetContextState failed

    o AccessViolationException

    o C++ Exception

    o CLR Exception

    In my application I am using multiple threads, while each thread has implemented a timer that fires each second (8 instances that get newly created each time the event function is called).  In addition the application polls the database each 5 seconds and updates a list.

    The PC is equipped with 4 core units, so we switched garbage collection mode to Server, which seems to solve the issue, the application is working properly, we "only" had 2 exceptions since we made the switch, in workstation mode it crashes regularly. The strange thing is, that in server mode it only crashes once, while being started again a couple of times, it doesn't crash. Could the GC possibly keep a state in memory? Because, if I wait a couple of hours and start the application again, the "pattern" can be seen again: crash, no crash, no crash, ...., no crash.

    It might be important to mention that we are using a CAPI driver with an AVM ISDN card.

    Any suggestions would be appreciated.

    Greetings,

    MiyagiSan


    • Edited by MiyagiSan Wednesday, December 7, 2016 7:49 AM
    Wednesday, December 7, 2016 7:48 AM

Answers

  • There's really no way for us to help you with this issue. The problem is most likely related to your use of threads. Given that you mention the GC thinks to consider include you are not properly managing the lifetime of your objects. It could also be issues with trying to access objects across multiple threads that aren't designed to be multi-threaded.

    Given that you also mentioned CAPI I would start leaning toward you improperly using using statements and IDisposable to either clean up objects too earlier or perhaps never clean them up. Threading would also be an issue if you were using a COM object across multiple threads and the COM object wasn't using an MTA or you weren't marshaling the requests.

    You're going to have to add some logging to your app. You'll also want to get a crash dump of your program when the error occurs. Then move the crash dump, the source and the binaries being used to a machine with VS so that you can open your app and see what was going on at the time.

    Michael Taylor
    http://www.michaeltaylorp3.net

    Wednesday, December 7, 2016 5:19 PM

All replies

  • There's really no way for us to help you with this issue. The problem is most likely related to your use of threads. Given that you mention the GC thinks to consider include you are not properly managing the lifetime of your objects. It could also be issues with trying to access objects across multiple threads that aren't designed to be multi-threaded.

    Given that you also mentioned CAPI I would start leaning toward you improperly using using statements and IDisposable to either clean up objects too earlier or perhaps never clean them up. Threading would also be an issue if you were using a COM object across multiple threads and the COM object wasn't using an MTA or you weren't marshaling the requests.

    You're going to have to add some logging to your app. You'll also want to get a crash dump of your program when the error occurs. Then move the crash dump, the source and the binaries being used to a machine with VS so that you can open your app and see what was going on at the time.

    Michael Taylor
    http://www.michaeltaylorp3.net

    Wednesday, December 7, 2016 5:19 PM
  • Hi MiyagiSan,

    If your issue is solved please Mark as answer or Vote as helpful post to the appropriate answer so that it will help other members to find solution if they faces similar issue.


    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Tuesday, December 13, 2016 11:11 AM
  • Hi,

    Any update?


    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Monday, December 19, 2016 3:14 PM