(It Just) Has To Be .Net
Two long-term IT techies, with a penchant for Microsoft's .NET Framework, air views on whatever topics take their fancy.

Workflow Foundation error binding properties on custom activities

This one had me going round in circles for a good few minutes...

While developing a custom activity today, I found myself reorganising some of my service contracts.

My custom activity is very simple, having a single incoming DependencyProperty containing a Sales Order and returning an Id via another DependencyProperty. The incoming sales order property needed to be re-bound in my workflow as I'd ended up changing the namespace.

On attempting to bind the property, Visual Studio very kindly gave me the following error:

Path resolved to Referenced activity Property 'SalesOrder' whose PropertyType 'TheNamespace.SalesOrder' does not match with the Target Type 'TheNamespace.SalesOrder'

A somewhat confusing message, it appears to be whinging that the two properties I'm trying to bind together are of the same type and it doesn't like it.

I checked and double-checked everything I could think of. The error smacks of the kind of error you get when two copies of the same assembly are loaded into an app domain but there was no reason for anything like that.

So, I shut down Visual Studio, grabbed a coffee and Googled for others with the same issue. I didn't find many references to the same problem, but the answer was there all along.

Marcel de Vries came to the rescue with his post WF Dependency property binding throws error on custom activities when changing types.

It turns out, I'd already fixed the problem, by shutting down Visual Studio before that well earned coffee. On restarting VS and reloading the solution, I was able to bind the property without any problem.

I'd call that a bug.


Posted Aug 11 2008, 06:11 PM by Steve Morgan

Comments

Steve Morgan wrote re: Workflow Foundation error binding properties on custom activities
on Mon, Aug 18 2008 12:42

Update:

I've had this error a few times since and typically found it necessary to add the extra step of clearing the Visual Studio Project Assemblies cache:

On XP, it's to be found at

%UserProfile%\Local Settings\Application Data\Microsoft\VisualStudio\9.0\ProjectAssemblies

On Vista, slightly different:

%UserProfile%\AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies

So, the revised process is to shut down Visual Studio, delete the contents of the ProjectAssemblies folder and restart Visual Studio. It's worked for me consistently, now.

Steve Morgan 2008. All rights reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems