【问题标题】:WPF application crashes when going into standbyWPF 应用程序在进入待机状态时崩溃
【发布时间】:2009-11-01 15:17:54
【问题描述】:

我有一个 WPF 应用程序。它运行正常,但是当计算机进入“待机”模式时,它会崩溃,出现未知异常。

这可能与我的窗口是透明的事实有关。
我正在使用带有 SP1 的 .NET 3.5。
有人有想法吗?

编辑 1

当窗口位于 Visibility.Collapsed 时 - 应用不会崩溃。
当窗口没有透明度时 - 它也不会崩溃。

这是堆栈跟踪:

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()

【问题讨论】:

  • 这是您以某种方式编写或开发的应用程序吗?如果是这样,为什么不能从异常中收集更多信息?如果没有,这个问题属于 SU。
  • 您是否附加了调试器以查看它是托管异常还是获取调用堆栈?
  • 能否附上完整的堆栈跟踪信息?如果不靠猜测,任何人都无法提供帮助。
  • 我添加了堆栈跟踪。问题是系统开始关闭后发生异常,并且我的 Visual Studio 已经不活动。我设法使用记录器获取跟踪。

标签: wpf standby


【解决方案1】:

如果是访问冲突或类似的非托管异常,请尝试禁用显卡驱动程序中的所有硬件加速,看看问题是否仍然存在。如果不是,那就是驱动问题。到目前为止,我在 WPF 应用程序中看到的唯一真正的非托管异常与不良驱动程序有关。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-08
    • 2023-03-03
    • 2011-01-01
    相关资源
    最近更新 更多