none
Input Args Error RRS feed

  • Question

  •  

    Hi All,

    I am passing List<myclass> type as input argument to WF. And I am getting the following error:

    The following errors were encountered while processing the workflow tree:
    'Literal<List<myclassname>>': Literal only supports value types and the immutable type System.String.  The type System.Collections.Generic.List`1[namespace.myclassname] cannot be used as a literal.

     

    Any suggestions?

    Thursday, September 2, 2010 7:29 PM

Answers

  • LambdaValue is actually an expression activity- add System.Activities.Expressions to get access.

    The hosting code is also in that article- if your input argument is called InputList, you can add it like so:

    var abc = new List<class1> { class1object1, class1object2, class1object3 }

    myWorkflow.InputList = new LambdaValue<List<class1>>((context)=>abc);

    • Marked as answer by WMeher Thursday, September 2, 2010 8:07 PM
    Thursday, September 2, 2010 8:06 PM
    Moderator

All replies

  • The release version of WF removed the ability to pass reference types as arguments directly into a workfow- you'll need to use a LambdaValue<> or VisualBasicValue<> expression to pass the argument. See the following article for details:

    http://social.technet.microsoft.com/wiki/contents/articles/using-reference-type-arguments-in-a-workflow-wf.aspx

    Thursday, September 2, 2010 7:32 PM
    Moderator
  • Thanks patrick,

    Since I am new to LINQ, what are the namespaces required to show LambdaValue in intellisens?

    I used system.linq, but of no use.

     

    Thursday, September 2, 2010 7:46 PM
  • public List<class1> abc;

    I need to send "abc" as input argument.

    Can you provide me the Hosting code not the workflow code.

    Thanks

    Thursday, September 2, 2010 7:49 PM
  • LambdaValue is actually an expression activity- add System.Activities.Expressions to get access.

    The hosting code is also in that article- if your input argument is called InputList, you can add it like so:

    var abc = new List<class1> { class1object1, class1object2, class1object3 }

    myWorkflow.InputList = new LambdaValue<List<class1>>((context)=>abc);

    • Marked as answer by WMeher Thursday, September 2, 2010 8:07 PM
    Thursday, September 2, 2010 8:06 PM
    Moderator
  • Thanks it worked!
    Thursday, September 2, 2010 8:07 PM