Exception: Invoke a Code Activity - Using Microsoft.Activities.Extentions RRS feed

  • General discussion

  • Hi

    Using the example : Windows Workflow Foundation (WF4) - How To Invoke a Child Workflow as XAML

    I put together my own project using this project as an example, but using the most up-to-date packages 'Microsoft.Activities.Extentions' v2.0.6.9, instead of the older 'Microsoft.Activities' package as the example project uses.

    The example I want to recreate is the 'Invoke a Code Activity' from a class library assembly.

    This all went well up until the point I ran the project and the workflow was invoked. It set the dictionary values correctly as scripted in my workflow and then tried to invoke code activity from my class library (assembly).

    At this point it threw an exception as follows:

    16: Activity [1.20] "Invoke a Code Activity" scheduled child activity [1.21] "Invoke a Compiled Activity"
    A first chance exception of type 'System.NullReferenceException' occurred in Anonymously Hosted DynamicMethods Assembly
    17: Activity [1.21] "Invoke a Compiled Activity" is Faulted
    18: Fault source [1.21] "Invoke a Compiled Activity"
    19: WorkflowInstance "DynamicActivity" Unhandled Exception Source "Invoke a Compiled Activity" Exception <System.NullReferenceException: Object reference not set to an instance of an object.
       at lambda_method(Closure , ActivityContext )
       at Microsoft.VisualBasic.Activities.VisualBasicValue`1.GetValueCore(ActivityContext context)
       at Microsoft.VisualBasic.Activities.VisualBasicValue`1.TryGetValue(ActivityContext context, TResult& value)
       at System.Activities.InArgument`1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityContext resolutionContext)
       at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityContext resolutionContext, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
       at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
       at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)>
    The thread 'DebuggerThread:DynamicActivity.0' (0x1d28) has exited with code 0 (0x0).
    20: Activity [1.20] "Invoke a Code Activity" is Faulted
    21: Activity [1.1] "Sequence" is Faulted

    I've been over and over each of the projects and cannot see where I have gone wrong, bear in mind I'm new to c# and workflow, my background is c++

    Any thoughts on what I'm doing wrong?



    • Changed type LeoTang Friday, October 5, 2012 7:39 AM
    Tuesday, September 25, 2012 4:24 PM

All replies

  • It sounds like the root cause might be an NRE... Could you turn on your debugger's option to break when NullReferenceException is thrown (as opposed to unhandled) and see exact source of the first chance exception? You may need to disable the debugger option 'just my code' to see where it is thrown, if it is not inside your own code.
    Tuesday, September 25, 2012 8:22 PM