开发者

Windows Forms Out of Memory Exception from Aero Shake and Remote Desktop Disconnect

I have a windows form app which displays a couple of live charts using the NPlot library. Whenever I accidentally engage an aero shake (shaking a window causing windows to minimize all other windows), or when I run my app over remote desktop and the remote desktop connection disconnects due to a network error my .Net application crashes with an OutOfMemory exception.

After some profiling, I've confirmed this is not a real out of memory exception, but rather some sort of resource problem - any ideas where to go from here?

Per r开发者_运维百科equest - my stack trace is below, sadly it is essentially saying that my CCR worker thread received an outofmemoryexception (all of my code runs as tasks on the CCR thread pool).

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.OutOfMemoryException
Stack:
   at Microsoft.Ccr.Core.TaskExecutionWorker.ExecutionLoop()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


I don't have an here's-how-to-fix-it answer, and I don't think you'll get one due to insufficient information about the crash.

However, I do have some tips on how to isolate this problem, how I'd go about debugging such a tough problem myself:

First, I'd confirm that the NPlot library is causing the problem. If no NPlot stuff is on screen, does it still crash? Using the CCR (Concurrency and Coordination Runtime, right?) is another possibility, as that's doing some rather funky stuff with yield return continuation-passing style. You might try running your tasks as .NET 4 TPL Tasks, rather than CCR tasks, see if that's changing anything.

Bottom line: isolate what component is causing the problem: NPlot, CCR, or something else?

Some other bits that might help: isolate the last piece of code that executes before the problem occurs. Is it a consistent last piece of code? Or is it random? Try getting the crash to occur while running under the debugger.

Finally, you should confirm that what you're seeing is not an OS bug. For example, a quick search for "OutOfMemoryException remote desktop" shows you're not the first to hit this, and may actually be a bug in the OS, and one of your components just happens to poke that bug.

And if all else fails, you might have to bust out the heavy equipment: Windbg+SOS.

My gut instinct here is, since your exception occurs when doing visual stuff (Aero shake, or remote desktop), I'm betting your NPlot charting library is the cause of the problem. Start there, and isolate it from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜