Manualy editing workflow 4.5 results in XamlObjectWriterException
Since the Team Build workflow of VS 2012 runs on Windows Workflow 4.5, our internal Team Build Customizations for our software factory called Endeavour use Windows workflow 4.5 as well. During the development of these customizations we ran against this validation exception from within the Xaml targets:
Error 170 Extension ‘Microsoft.Activities.Build.Validation.ValidationBuildExtension’ threw an exception of type ‘System.Xaml.XamlObjectWriterException’ : ‘The invocation of the constructor on type ‘<classname>’ that matches the specified binding constraints threw an exception.’. C:WindowsMicrosoft.NETFrameworkv4.0.3031Microsoft.Xaml.targets
This usually happens if we manually edit the workflow and re-use namespaces mappings or use a strong name for a given assembly twice in the namespace declaration. while we haven’t been able to locate it specifically, the interesting part is that the visual studio designer can however still read this file. So for us this workaround usually works against this error:
- Open the workflow in the designer
- Change a title or description
- Save the workflow (you will get a message that the encoding of the file has been changed).
- Revert the title or description back
- Save the workflow
- Open the file to see if your change is still there (maybe with a different namespace imports and mapping names now).
- Compile
Its a strange defect which we saw in both the Beta, RC, and the RTM of VS 2012. We filed a connect issue, but since it’s very hard to repro there hasn’t been a fix yet.