You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a situation where we have XPS documents being created.
Each XPS documents is handled in their own thread.
No problem here so far.
Each XPS document adds a Visual to their document.
It is the same visual.
This works but is slow when processing a lot of files as we need to create the Visual each time again per XPS document.
(let's say 10.000 times).
Instead we added a MemoryCache where we store the Visual serialized.
Retrieving the Visual from MemoryCache is where we "reset" it by deserializing it back to a Visual and then setting the FixedPage "ChangeLogicalParent" to null.
This allows us to use the Visual on a different thread.
This all worked fine, but since a few weeks this "trick" that allows us to "detach/reset" a Visual and cache it so it can be used by another thread has stopped working and thus the complete caching doesn't work anymore.
Now it gives:
The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Media.DrawingVisual.GetDrawing()
...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have a situation where we have XPS documents being created.
Each XPS documents is handled in their own thread.
No problem here so far.
Each XPS document adds a Visual to their document.
It is the same visual.
This works but is slow when processing a lot of files as we need to create the Visual each time again per XPS document.
(let's say 10.000 times).
Instead we added a MemoryCache where we store the Visual serialized.
Retrieving the Visual from MemoryCache is where we "reset" it by deserializing it back to a Visual and then setting the FixedPage "ChangeLogicalParent" to null.
This allows us to use the Visual on a different thread.
This all worked fine, but since a few weeks this "trick" that allows us to "detach/reset" a Visual and cache it so it can be used by another thread has stopped working and thus the complete caching doesn't work anymore.
Now it gives:
We are not sure if this is related to
https://support.microsoft.com/en-us/topic/kb5022083-change-in-how-wpf-based-applications-render-xps-documents-a4ae4fa4-bc58-4c37-acdd-5eebc4e34556
The question:
Why does setting
"ChangeLogicalParent"
tonull
not work anymore? What broke it? And what is now the "new" way of getting this same result?Beta Was this translation helpful? Give feedback.
All reactions