vCAC: TryCatch Activity only fires exception on GetMachineProperty when activity “Is Required”

When retrieving a machine property in the Workflow Designer of vCAC that does not exist and later on access the internal workflow variable holding that machine property value you will receive a “System.NullReferenceException”.

[UTC:21/07/13 13:11:30.255 Local:21/07 15:11] [Error]: <?xml version="1.0" encoding="utf-16"?>
<boolean>false</boolean>
Workflow "WFStubMachineProvisioned" failed with the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at lambda_method(Closure , ActivityContext )
   at Microsoft.VisualBasic.Activities.VisualBasicValue`1.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

When using a “TryCatch” activity to react upon this condition an exception is only triggered when you set “Is Required” to “True” (regardless of what you defined in your catch block).

VCAC TryCatch Activity

VCAC TryCatch Activity with GetMachineProperty and “Is Required” = True

As a workaround for you can also pre-initialise the variables in your workflow and then you might not have to use the “TryCatch” activity at all.

VCAC PreInitialise Variables

VCAC PreInitialise Variables

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: