渲染线程上发生了未指定的错误.(NotifyPartitionIsZombie)

red*_*d-X 5 c# wpf multithreading render

好的就是这里的问题,我有一个来自thriple的ContentControl3D对象 ,我创建了一个运行良好的图像的LibraryStack,直到我运行创建和填充LibraryStack的函数.当我点击里面的任何对象时,我得到以下错误

An unspecified error occurred on the render thread.
Run Code Online (Sandbox Code Playgroud)

与stacktrace

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 WelkoMap.App.Main() in F:\MediaGarde\Surface\Development\WelkoMap\WelkoMap\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Run Code Online (Sandbox Code Playgroud)

这是添加和创建LibraryStack并填充它的代码

public void ReplaceBackContent(List<Image> images, List<MediaElement> videos)
{
    ContentControl3D control = this.TryFindParent<ContentControl3D>();
    if (control == null)
    {
        return;
    }
    LibraryStack stack = new LibraryStack();

    foreach (Image image in images)
    {
        if (image.Parent != null)
        {
            continue;
        }
        LibraryStackItem item = new LibraryStackItem();
        item.Content = image;
        stack.Items.Add(item);

    }
    control.BackContent = stack;
}
Run Code Online (Sandbox Code Playgroud)

由于它有NotifyPartitionIsZombie错误我已经安装了Windows更新KB967634,它完全没有任何影响

Dav*_*ead 1

我讨厌这个例外!我也在调查它,并认为我会发布我所发现的内容。

  • 您的显卡驱动程序是最新的吗?
  • 我还会使用 snoop 并检查其中一个对象并检查 NAN 的高度、宽度或位置。
  • 确保Window.AllowsTransparency 属性为 false

msdn上有一篇文章声称 WinDbg 内存转储可以帮助 Microsoft 进行调查。

我希望这里有帮助。