Cortego Password Sample ArgumentNullException
I am running the sample code from Cortego and running into the exception below. I am trying to set a hardcoded password to a workflow to be sent to a parameter in the next synchronization rule activity. I set the destination as [//WorkflowData/mfdsPassword].
Running the code and setting up the debugger, I get the exception. I have also tried the original WorkflowDictionary line of
containingWorkflow.WorkflowDictionary[destinationAttribute] = password;
System.ArgumentNullException: Value cannot be null.
Parameter name: collection
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Microsoft.ResourceManagement.Workflow.Hosting.RequestWorkItemProcessor.ProcessPutWorkItem(UpdateRequestWorkItem updateWorkItem)
at Microsoft.ResourceManagement.Workflow.Hosting.RequestWorkItemProcessor.ProcessWorkItem(WorkItem workItem)
void cGeneratePassword_ExecuteCode(object sender, EventArgs e)
{
// Try to get parent workflow.
SequentialWorkflow containingWorkflow = null;
if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow))
{
throw new InvalidOperationException("Could not get parent workflow!");
}
string password = "Password05";
// Separate destination and destination attribute.
string destination = Utils.ExtractWorkflowExpression(Destination, Utils.ExpressionParts.WorkflowParameter);
string destinationAttribute = Utils.ExtractWorkflowExpression(Destination, Utils.ExpressionParts.ParameterAttribute);
if (!string.IsNullOrEmpty(destinationAttribute))
{
if (destination.ToLower() == "workflowdata")
{
// Write output value to WorkflowDictionary.
if (containingWorkflow != null)
{
containingWorkflow.WorkflowDictionary.Add("mfdsPassword", password);
}
}
}
}
protected override ActivityExecutionStatus HandleFault(ActivityExecutionContext executionContext, Exception exception)
{
return base.HandleFault(executionContext, exception);
}
May 24th, 2010 4:30pm
I am not sure, but it is now working. I put 'containingWorkflow.WorkflowDictionary[destinationAttribute] = password;' back in the code and things are now working. Sorry I do not have a solution for anyone but if I find out, I will post.
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2010 10:56pm