Could not find a Public, Static field with name 'xyz' of type DependencyProperty
Tuesday, March 10, 2009 at 12:56AM When building custom workflow activities for CRM 4.0 pay attention to the names you give the dependency properties or you might just end up with this error.
Let’s look at a quick example of a dependency property
public static readonly DependencyProperty ResultProperty = DependencyProperty.Register
("Result", typeof(string), typeof(MyWorkflowType));
[CrmOutput("Result")]
public string result
{
get
{
return (string)base.GetValue(ResultProperty);
}
set
{
base.SetValue(ResultProperty, value);
}
}
The part to pay attention to above is highlighted in red. The code will compile fine but when you attempt to register it with CRM using the registration tool you will receive an exception. The error will say “Could not find a Public, Static field with name “resultProperty” of type DependencyProperty.
Why’s this happen? It appears that during registration MSCRM does a validation to ensure that you have a dependency property. It expects the case of the name to be the same. So in this case it wanted ResultProperty to be resultProperty with a lower case “r”.

Reader Comments