none
NullReferenceException when using Assign Activity RRS feed

  • Question

  • I have created a workflow that contains a an assign activity that is setting a property on a variable of a custom class in the workflow. Basically I just have a Sequence activity with a variable that contains an Assign activity that is setting a property of that variable.

    After the setter code of the property completes I get this NullReferenceException that I cannot figure out:

    Message = "Object reference not set to an instance of an object."

    StackTrace = "      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.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 custom class object is not null because the setter of the property is called and sets the private field correctly but the instant it returns this exception is throw.

    Does anyone have any idea why this is happening?

     

     

    Tuesday, December 14, 2010 1:04 AM

Answers

  • Discovered the error was actually in the next assign. Debugging workflows is a very difficult thing.
    • Marked as answer by erothvt Tuesday, December 14, 2010 4:23 PM
    Tuesday, December 14, 2010 4:23 PM

All replies

  • Discovered the error was actually in the next assign. Debugging workflows is a very difficult thing.
    • Marked as answer by erothvt Tuesday, December 14, 2010 4:23 PM
    Tuesday, December 14, 2010 4:23 PM
  • How did you solve the error on the next assign? I am also havinga similar problem
    Wednesday, September 21, 2011 10:50 AM
  • You could create an assign activity before use that variable and create new instance of it.

    it solved my problem easily.


    Thanks. Bahar Ghadami Web Developer And Technical expert

    Monday, October 14, 2013 11:33 AM