Web Services API: CompleteActivityInstance error : System.NullReferenceException: Object reference not set to an instance of an object

Issue

When calling the complete activity instance web service I get the following error:

System.NullReferenceException: Object reference not set to an instance of an object.  
at Advantys.My.Globalization.TimeZoneInformation.GetTimeZone(Int32 timezoneIdentifier)  
at Advantys.Workflow.Web.Services.Processes.Runtime.RuntimeService.CompleteActivityInstance(Int32 processInstanceId, Int32 activityInstanceId, String workflowContext)

Configuration

  • The wfgen_admin username is entered as mydomain/wfgen_admin

  • The ApplicationSecurityRemoveDomainPrefix entry in the web.config file has been set to _all.

  • If we remove the web.config setting we will get a user is not a participant error when trying to call completeactivity.

Cause

The _all value in the ApplicationSecurityRemoveDomainPrefix parameter removes the domain name in the login name, which is why you are getting the error message, because the user is no longer found in the database after the domain name was removed from the login name:

  1. The user’s username is stored as mydomain\wfgen_admin in the database.

  2. ApplicationSecurityRemoveDomainPrefix is set to _all, which removes the domain name from login name

  3. When you log in with mydomain\wfgen_admin, this will become wfgen_admin once ApplicationSecurityRemoveDomainPrefix is applied.

  4. WorkflowGen then tries to find a user where username is equal to wfgen_admin, but couldn’t find it because the username is stored as mydomain\wfgen_admin.

Solution

The solution is to not skip the domain name for users whose usernames are prefixed by a domain name.