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':  
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,

1 Answer 1


I have found the solution: There was another workflow attached to the list that was also triggered by the creation of a new item. That workflow was a SharePoint Designer workflow and, as far as I could figure out, the list has had some fields added and/or removed since that workflow was last changed, and this mismatch caused it to fail.

I am not sure why that would make my workflow fail, too. But after I tried - without success - to disable that workflow, I finally got a correlation ID from the SharePoint web interface and grepping for that I found some error messages that pointed me to the mismatch in list structure between the list and the workflow. I consulted with the author of the workflow who assured me it was not really in use, so I deleted it.

And voila - my workflow runs without errors. Now I just need to make it do something useful.

EDIT: I was too quick to announce success: Sending an email still fails with the same error. Everything else - the parts that are in place, at least, seems to work fine. I double- and triple-checked another Visual Studio workflow that also sends mail, and I cannot see any difference. Do I have to enable sending email on a per-site basis or something like that?

EDIT once again: Using Fiddler, I was able to snoop in on the Workflow Manager talking to SharePoint and there I did find a helpful - well slightly more helpful - error message: code=-2130242040, Microsoft.SharePoint.SPException, The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.

This only increases my confusion though, because there is a valid eMail address in the To-Field:

new System.Collections.ObjectModel.Collection<string>()
            "[email protected]"

Well, the string contains my actual email address, of course.

I have used this in another Workflow before and it worked fine. Just to be extra sure, I replaced my address with the one I extracted from the list item, this did not change the result, though.

Just for fun, I added both my email address and the one from the list item, but ... you guessed it ... the result is the same. By now I only refrain from throwing my hands in the air in desparation long enough to write these words. What am I missing? I found examples of people online who were getting the same error message, but none of the replies they got were helpful.

EDIT, sigh, yet once more: When using the user object from the list item, everything works fine. When I set the To-Collection like this

new System.Collections.ObjectModel.Collection<string>()
            "[email protected]"

then the user stored in Project_Manager (which is taken from the corresponding field in the list item), the email is delivered to the project manager, as it should, but not to me.
The weird part is that in another workflow, I did use verbatim email addresses, and it worked just fine. That other one was also a SharePoint 2013 Visual Studio workflow.
Which is kind of annoying, because I really want to receive those emails as well during the development/debugging of that workflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.