WPF, UserControls and the dreaded NotifyPartitionIsZombie error.

WPF, UserControls and the dreaded NotifyPartitionIsZombie error.

Old forum URL: forums.lhotka.net/forums/t/6223.aspx


Fintanv posted on Wednesday, January 21, 2009

I am wondering if anyone has experienced a similar issue to the one I am about to describe.

I am developing a WPF application using CSLA 3.6 and .net 3.5sp1.  For the initial dev work I set up a parent window with menu items.  Clicking a menu item did the following:
1. Find the user control display Grid and remove/dispose the user control hosted there (if any).
2. Create a new user control (depends on the menu item clicked), the usercontrol hosts the UI interface for a specific BO.
3. Load the new user control to the display Grid.

Worked fine, but I really wanted to allow the user to have multiple BO interfaces open.  No worries simply replace the Grid with a tab control and host the user control one per tab.  I hooked this up and it initially appeared to work, though switching between tabs was a little sluggish.  The problem came when I edited one of the business objects and then switched off the tab, and then switched back to the same tab...BOOM!

System.InvalidOperationException was unhandled
  Message="An unspecified error occurred on the render thread."
  Source="PresentationCore"
  StackTrace:
       at System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32 failureCode)
...
...

Some research on Google brought up some discussions (pre 3.5sp1) concerning one or more of: the WPF rendering thread, video drivers, how they interact with directx 9, the use of the Window property AllowsTransparency being set to true, and something returing a value that is NaN.  An issue seemingly fixed with sp1. Since my main Window has the AllowsTransparency set to false, and since I am using sp1, I am stumped.  Attaching with a debugger yielded no further info as to the source.

I have changed directions and implementing what amounts to a card stack instead.  Gone is the exception, and switching between user controls is also faster than with the tabs.  But I am still uneasy due to the error.

Anyone have any similar experiences or insights?

-- Fintan

sergeyb replied on Wednesday, January 21, 2009

What you see I  believe is a known issues of tab control, that is the result of total rebinding on tab switches.  I think if you google it, you will find you are not alone.  In our app we actually are not using tab control, but instead simulating it with a stack panel full of buttons with the grid underneath. 

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: Fintanv [mailto:cslanet@lhotka.net]
Sent: Wednesday, January 21, 2009 11:20 AM
To: Sergey Barskiy
Subject: [CSLA .NET] WPF, UserControls and the dreaded NotifyPartitionIsZombie error.

 

I am wondering if anyone has experienced a similar issue to the one I am about to describe.

I am developing a WPF application using CSLA 3.6 and .net 3.5sp1.  For the initial dev work I set up a parent window with menu items.  Clicking a menu item did the following:
1. Find the user control display Grid and remove/dispose the user control hosted there (if any).
2. Create a new user control (depends on the menu item clicked), the usercontrol hosts the UI interface for a specific BO.
3. Load the new user control to the display Grid.

Worked fine, but I really wanted to allow the user to have multiple BO interfaces open.  No worries simply replace the Grid with a tab control and host the user control one per tab.  I hooked this up and it initially appeared to work, though switching between tabs was a little sluggish.  The problem came when I edited one of the business objects and then switched off the tab, and then switched back to the same tab...BOOM!

System.InvalidOperationException was unhandled
  Message="An unspecified error occurred on the render thread."
  Source="PresentationCore"
  StackTrace:
       at System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32 failureCode)
...
...

Some research on Google brought up some discussions (pre 3.5sp1) concerning one or more of: the WPF rendering thread, video drivers, how they interact with directx 9, the use of the Window property AllowsTransparency being set to true, and something returing a value that is NaN.  An issue seemingly fixed with sp1. Since my main Window has the AllowsTransparency set to false, and since I am using sp1, I am stumped.  Attaching with a debugger yielded no further info as to the source.

I have changed directions and implementing what amounts to a card stack instead.  Gone is the exception, and switching between user controls is also faster than with the tabs.  But I am still uneasy due to the error.

Anyone have any similar experiences or insights?

-- Fintan


Copyright (c) Marimer LLC