1

In my workflow I call a service which returns me a List. The problem is that in my workflow i use a AddToCollection Activitie to add a new string to the collection, but i get an error right when i get to the activity.

Debugging and checking i got to theworkflow logs and now I see that the error is that "Collection was of a fixed size." Here's the complete log:

System.SZArrayHelper.Add[T](T value) System.Activities.Statements.AddToCollection`1.Execute(CodeActivityContext context) System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

What i don't get is why (and how this happened)? Is this a bug? I specifically return a List... why does it says it's fixed sized?!?

EDIT 1: There's something really weird... since my original workflow was quite big I created a new, smaller one, just to reproduce this error... and I can't!

Leonardo
  • 10,737
  • 10
  • 62
  • 155
  • Your service is probably returning an array, which indeed is a IList but items cannot be added to it. – Joao Mar 13 '13 at 22:07
  • @Jota That was correct! in the service configuration i was setting colletion to System.Array! But the problem remains... – Leonardo Mar 14 '13 at 13:44
  • Can you show the service code where the list is handled and returned? – Joao Mar 14 '13 at 14:38

1 Answers1

1

My guess is that WCF is serializing your list to array before sending it over the wire. Don't know if it is possible to avoid.

Anyway, check this and this

You can also create a new Variable on your workflow and assign a List to it when you receive it from the service:

listWFVariable = new List<string>(arrayReceivedFromWebService);

Now you can make Add operations to it.

Community
  • 1
  • 1
Joao
  • 7,366
  • 4
  • 32
  • 48