I am currently trying to develop a SharePoint 2013 Visual Studio Workflow, and I get a rather confusing (to me, at least) error.
The workflow is a list workflow, to be started for newly created items. The list contains one currency column. I created a Workflow variable of type System.Decimal to hold the value from that column.
When trying to debug the workflow, I get the following error message:
Error occurred in deployment stept 'Activate Features': Microsoft.Workflow.Client.ActivityValidationException: Invalid type(s) 'System.Decimal'
The last line is repeated ... repeatedly, and finally I get:
Reached maximum number of validation errors: 10.
At this point, I was kind of confused. System.Decimal is ... well part of the System namespace. One does not even have to reference any special assembly to use it (at least in C#).
It gets more confusing, though: When I restart the WorkflowServiceBackend and try again, it works. Most of the time, at least, like 9 out of 10 attempts. In the 10th attempt, restarting WorkflowServiceBackend again will fix it.
Or does it? At this point I run into a different error that so far confuses me at least as much as the first one. A distinct lack of helpful error messages (this is SharePoint, after all...) forces me to guess, but I strongly suspect this problem to be related to the validation error above:
My workflow, so far, is very humble: It writes a message to the workflow history that says "Workflow has been started", then it looks up the current list item that triggered the workflow to be started and extracts the fields that are relevant to me into workflow variables.
At this point I try to write a second message to the workflow history, presenting the values I extracted from the list item.
Next, I try to send an eMail to myself that contains the same information.
Except that the workflow runs into an exception when trying to write the message to the history:
An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentNullException: Value must not be NULL. Parameter name: Input
I wrapped the offending activity in a Try-Catch-Block, catching Exception (which should catch everything, right? Or so I thought...), but when debugging the workflow, as soon as execution arrives at that WriteToHistory activity, debugging stops without an opportunity to find out what has gone wrong. The Catch-clause (which terminates the workflow with a static error message) is not executed, either.
I did look at the content of the string I am trying to write to the workflow history, though - it is most definitely not NULL. When I look at the debug message string in the debugger, it does in fact look exactly as I expected it would. None of the workflow variables is NULL, either.
So at this point, I am really confused. I have encountered the deployment error about invalid type(s) before when deploying a workflow that used a custom activity written in C#. But the workflow that currently drives me crazy does not use a custom activity.
Has anyone encountered this kind of weirdness before? And if so, did you find a solution? Or at least some useful hints?
Thank you very, very, very much for any insights you might feel like sharing with me,