Invoke Code: No compiled code to run error BC31051: Namespace or type 'System.ComponentModel' has already been imported. At line -10

Hi there,

I am using invoke code in my work flow to convert a column to double, this is the error, but I do have these already imported and I cant remove it from my imports, so my compiled code does not run.

this is the invoke code:

dt_deposita.AsEnumerable().ToList().ForEach(Sub(row)
row(“Amount”) = Convert.ToDouble(row(“Amount”).ToString())
End Sub)

1 Like

The issue you’re experiencing typically occurs when there’s a conflict with “Imports” in UiPath. You might be importing a namespace that’s already somewhere in the dependency tree or is conflicting in some way.

To resolve this issue, You can try the following steps:

  1. Verify your imports: Go to the ‘Imports’ panel in UiPath Studio and ensure that you haven’t imported System.ComponentModel twice, remove if it is there.
  2. Ensure that the ‘System’ is only imported once. Sometimes, importing both ‘System’ and System.ComponentModel can cause issues.
  3. Check your dependencies: You may also be utilizing a custom library or package that has already imported the System.ComponentModel namespace.

After performing the above steps, you should be able to resolve the error.

1 Like

Ive done the first two steps, how do I check my dependencies to see if it Utilizing this and remove it?

1 Like

Hi @Aki1111 ,

Maybe also you could check the below post which has the similar issue reported :

3 Likes

image

Also, close the Studio project, open the xaml file(s) in Notepad and check the namespaces, especially the System.ComponentModel.

2 Likes

Those namespaces come back after the 2nd run.

1 Like

Close the Studio project, open all the xaml files in Notepad and check the namespaces, especially the System.ComponentModel.

2 Likes

Hi all,
In my case, removing the duplicated “System.Collections.ObjectModel” from the XAML did the trick, I am using a custom library and it was not sending the email.

Why are they duplicated though? This is the first time this has happened to me.

1 Like

I also experienced this while I had a Windows Legacy project that imported a custom Library that I made and hosted on UiPath Orchestrator Cloud. I kept seeing this issue. I just have to remove the second duplicate line of “System.Collections.ObjectModel” from the workflow .xaml within the main UiPath project that is invoking the library activity and it fixes the issue. I wonder why this started happening? Maybe the new UiPath Studio 2022.10.3 or version 2022.10.4 is the culprit when you edit a new workflow that is running an old Library activity?

Actually that does not fix the issue and I still have the same bug.