Peter Goodman bio photo

Peter Goodman

A software engineer and leader living in Auckland building products and teams. Originally from Derry, Ireland.

Twitter Google+ LinkedIn Github

If you are using the IRegisterMetadata type combined with the *.Design.dll deployment method for your custom WF4 activities, you need to be careful if you have an activity derived from a base activity.

For example if you have code like the following:

            builder.AddCustomAttributes(
                typeof(MyBaseActivity<>),
                "MyProperty",
                new EditorAttribute(typeof(MyPropertyValueEditor), typeof(PropertyValueEditor)));

Then you need to be aware that on the standard properties you can declare your EditorAttribute against the base class but for Argument property types you will need to declare them on the derived class. So the above example would work if MyProperty was a string for example, but if it was an InArgument<string> then you would need to register custom attributes against the derived class and for each derived class.

I suspect the WF designer is automagically adding custom attributes for the Argument properties (to enable the Expression Text Box in the properties grid) against the derived classes and are hence overriding our base registrations.