WPF application crashes when going into standby

standbywpf

I have a WPF application. It runs ok, but when the computer goes into "Stand by" mode it crashes, with an unknown exception.

This might have something to do with the fact that my window is transparent.
I am using .NET 3.5 with SP1.
Does anyone have an idea?

Edit 1

When the window is in Visibility.Collapsed – the app doesn't crash.
When the window has no transparency – it also doesn't crash.

This is the stack trace:

System.InvalidOperationException: An unspecified error occurred on the render thread. 

at System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32 failureCode) 
at System.Windows.Media.MediaContext.NotifyChannelMessage() 
at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam) 
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) 
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) 
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) 
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
at System.Windows.Threading.Dispatcher.Run() 
at System.Windows.Application.RunDispatcher(Object ignore) 
at System.Windows.Application.RunInternal(Window window) 
at System.Windows.Application.Run(Window window) 
at System.Windows.Application.Run() 
at Widget.App.Main() in C:\Documents and Settings\Lehavi\My Documents\Working Version\Widget\obj\Release\App.g.cs:line 0 
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) 
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) 
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) 
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() 
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) 
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) 
at System.Activator.CreateInstance(ActivationContext activationContext) 
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() 
at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
at System.Threading.ThreadHelper.ThreadStart()

Best Solution

In case it is an acess violation or similar unmanaged exception, try to disable all hardware acceleration in your graphic card drivers and see if the problem still occurs. If it doesn't it is a driver issue. The only true unmanaged exception I have seen so far with WPF applications, have been related to to poor drivers.

Related Question