Answered by:
Random System.Xaml.XamlObjectWriterException while loading or persisting workflow: Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Point'

Question
-
We are unable to nail down the exact cause for the following exception that occurs randomly in our application while loading or persisting workflows based on WorkflowApplication used within an ASP.NET MVC web-application.
StackTrace1: Exception caused when we call WorkflowApplication.Persist
System.Xaml.XamlObjectWriterException: Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Point'.
at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Activities.XamlIntegration.FuncDeferringLoader.FuncFactory`1.Evaluate()
at System.Activities.DynamicActivity.OnInternalCacheMetadata(Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.WorkflowApplication.EnsureInitialized()
at System.Activities.WorkflowApplication.Enqueue(InstanceOperation operation, Boolean push)
at System.Activities.WorkflowApplication.WaitForTurn(InstanceOperation operation, TimeSpan timeout)
at System.Activities.WorkflowApplication.Persist(TimeSpan timeout)StackTrace2: Exception caused when we call WorkflowApplication.Load
System.Xaml.XamlObjectWriterException: Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Point'.
at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Activities.XamlIntegration.FuncFactory`1.Evaluate()
at System.Activities.DynamicActivity.OnInternalCacheMetadata(Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
at System.Activities.WorkflowApplication.SetPersistenceManager(PersistenceManager newManager)
at System.Activities.WorkflowApplication.CreatePersistenceManager()
at System.Activities.WorkflowApplication.Load(Guid instanceId, TimeSpan timeout)Other details:
- All Xaml files are created using Workflow designer - thus they have mc:Ignorable attribute.
- Xaml files are loaded using ActivityXamlServices.Load(reader) and we are also setting LocalAssembly to the one that contains Xaml files as embedded resources.
- We are setting SynchronizationContext while creating WorkflowApplication so as to use ASP.NET provided SynchroniationContext.
- We are not calling SynchronizationContext.OperationStarted or OperationCompleted anywhere - not sure why it would be needed in this case.
- All our workflows use bookmarks which get persisted in InstanceStore set into WorkflowApplication using SqlWorkflowInstanceStore.
- We have referenced and also added in web.config assemblies section the following: WindowsBase, PresentationCore, PresentationFramework
- The environment is Windows 2008 Server R2 where this error is seen randomly every 2-3 days.
Can anyone please help us resolve this exception? Not sure if it has something to do with IIS AppDomain recycling or resource leaks!
Any help will be much appreciated.
Thanks
Ravi Pathak
Friday, August 10, 2012 2:20 PM
Answers
-
Hi,
Check the workaround in following thread to see if it applies to your scenario:
URGENT - Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}PointCollection'
- Proposed as answer by Tim Lovell-Smith Wednesday, August 15, 2012 4:44 AM
- Marked as answer by LeoTang Friday, August 17, 2012 7:38 AM
Tuesday, August 14, 2012 8:00 AM -
Hi,
Check the workaround in following thread to see if it applies to your scenario:
URGENT - Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}PointCollection'
Please also check out this other thread in case the workaround mentioned there is helpful:
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/329bf6a7-0fe9-443d-a58a-71bea250cf13- Proposed as answer by Tim Lovell-Smith Wednesday, August 15, 2012 4:46 AM
- Marked as answer by LeoTang Friday, August 17, 2012 7:38 AM
Wednesday, August 15, 2012 4:45 AM
All replies
-
Hi,
Check the workaround in following thread to see if it applies to your scenario:
URGENT - Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}PointCollection'
- Proposed as answer by Tim Lovell-Smith Wednesday, August 15, 2012 4:44 AM
- Marked as answer by LeoTang Friday, August 17, 2012 7:38 AM
Tuesday, August 14, 2012 8:00 AM -
Hi,
Check the workaround in following thread to see if it applies to your scenario:
URGENT - Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}PointCollection'
Please also check out this other thread in case the workaround mentioned there is helpful:
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/329bf6a7-0fe9-443d-a58a-71bea250cf13- Proposed as answer by Tim Lovell-Smith Wednesday, August 15, 2012 4:46 AM
- Marked as answer by LeoTang Friday, August 17, 2012 7:38 AM
Wednesday, August 15, 2012 4:45 AM -
Note also, the root cause of this issue has to do with WPF Dispatcher resources being leaked per-thread. You can possibly come up with other workarounds based on your or IIS's usage of threads.
TimWednesday, August 15, 2012 4:48 AM