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:

1 Like

I had the same issue today with a multiple assign in 2021.10.5

To fix it I opened the XAML into notepad, and changed the “object” references to “string” and this fixed the issue.

Unfortunately I can’t remember the steps I used when creating the multiple assign.

1 Like

I just fixed a similar error message.
I had to look into the .xaml and found where the was an Object instead of the expected string. I also had to change the next mention of ‘Object’ in the mca:CSharpReference line to ‘String’ as well.
I knew I was expecting a string because in another nearly identical flow it was a string.