Exception When invoking Saved Xaml Workflow - by Kevin Van Looy

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 505460 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/29/2009 12:14:25 AM
Access Restriction Public


Following piece of code throws the exception where element.workpath is the path to the xaml file
the code is part of a running service , that needs to execute workflows.

Activity activity = ActivityXamlServices.Load(element.WorkflowPath);
WorkflowInvoker.Invoke(activity, new Dictionary<string, object> { { "InEvent", e } });

When loading the attached xaml activity an exception occurs 
It seems to fail on a part of the xaml : <mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>

When I remove this line it continues to load and even executes the flow but I can not access the arguments provided.

Failed to create a 'Settings' from the text 'Assembly references and imported namespaces serialized as XML namespaces'.</log4j:message><log4j:properties><log4j:data name="log4net:UserName" value="XPSP2TEST\Colos" /><log4j:data name="log4jmachinename" value="xpsp2test" /><log4j:data name="log4japp" value="DebugStart.exe" /><log4j:data name="log4net:HostName" value="xpsp2test" /></log4j:properties><log4j:throwable><![CDATA[System.Xaml.XamlObjectWriterException: Failed to create a 'Settings' from the text 'Assembly references and imported namespaces serialized as XML namespaces'. ---> System.TypeLoadException: Could not load type 'System.Activities.ReferenceAssemblyDeclarationAttribute' from assembly 'System.Activities, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable)
   at System.Reflection.CustomAttribute.IsDefined(RuntimeAssembly assembly, RuntimeType caType)
   at System.Reflection.RuntimeAssembly.IsDefined(Type attributeType, Boolean inherit)
   at Microsoft.VisualBasic.Activities.XamlIntegration.VisualBasicExpressionConverter.AssemblyCache.EnsureInitialized()
   at Microsoft.VisualBasic.Activities.XamlIntegration.VisualBasicExpressionConverter.CollectXmlNamespacesAndAssemblies(ITypeDescriptorContext context)
   at Microsoft.VisualBasic.Activities.XamlIntegration.VisualBasicSettingsConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value, XamlMember property)
   at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo)
Sign in to post a comment.
Posted by Kevin Van Looy on 11/2/2009 at 10:44 PM
Hi Stefan,

Where you able to reproduce the issue?
Because it didn't fail all the time only on my pc it was working all the time, on all other pc's we've tried it failed only when run from an goold old fashioned exe it worked.
When run from a service or remoting it fails with the above error.


Posted by Microsoft on 11/2/2009 at 6:15 PM
Thanks for posting about this problem.

We've done a lot of work in the VB expressions area in WF after Beta 2. So I just tried loading your file, as per the instructions you posted, on a post-beta2 build and it seems to be working now. So we are expecting to have this fixed in the final relase of WF 4.0.

Posted by Microsoft on 10/30/2009 at 12:23 AM
Thanks for your feedback. We are routing this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team