Bug Report - System.Activities.statements.Assign activity throws Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)

2021-06-24T18:30:00Z
Hello Community, I have problem with Assign activity

Issue is not showing in workflow designer

But, At Runtime, it is showing like below… But the same code working fine with multi assign activity

Message: Compilation failures occurred:

Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)

Complete results are contained in the Data property of this exception. Please correct the errors in the source and retry the Load.

Exception Type: System.InvalidOperationException

RemoteException wrapping System.InvalidOperationException: Compilation failures occurred:

Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)

Complete results are contained in the Data property of this exception. Please correct the errors in the source and retry the Load.
at System.Activities.XamlIntegration.ActivityXamlServices.Compile(IDynamicActivity dynamicActivity, LocationReferenceEnvironment environment)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(XamlReader xamlReader, ActivityXamlServicesSettings settings)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(XmlReader xmlReader, ActivityXamlServicesSettings settings)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(Stream stream, ActivityXamlServicesSettings settings)
at UiPath.Executor.WorkflowLoader.LoadWorkflow(String workflowFile)
at UiPath.Executor.WorkflowRuntime.Load(String workflowFile)
at UiPath.Executor.RobotRunner.InitWorkflowApplication()
at UiPath.Executor.RobotRunner.d__86.MoveNext()

PFA .xaml file for your reference
NumberValidation.xaml (24.9 KB)

Hi @sree_hari

Thanks for reporting. Your XAML file reproduces the issue on my end as well on the latest 21.6 version.

I’ll register a ticket for our team to have a look.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

I reopened it because the issue is not yet fixed. We will let you know when it is :slight_smile:

Hi @sree_hari

Our team looked into the issue and it comes down to a weird way this specific assign activity was coded in the XAML file. It points to an object while you are assigning a string:

image
image

The quick and easy fix here is to:

  • remove str_NewNumber from the assign activity
  • save the workflow
  • add str_NewNumber to the assign activity

This is a workaround.

As to the cause, we are not quite sure how to reproduce the root cause of the wrongly set variable type in the underlying xaml file.

Could you maybe share the steps you took? It would help us properly fix the issue :slight_smile: