Hello,
I have an Invode Code activity and it started to give this error, it was working before. Any ideas?
Hello,
I have an Invode Code activity and it started to give this error, it was working before. Any ideas?
Hi @Jenni_K !
Would you mind running again your workflow, and once the pop-up error happens, click on Details and copy the details section here ?
RemoteException wrapping System.ArgumentException: No compiled code to run
error CS1704: An assembly with the same simple name 'TelemetryClient, Version=1.1.51.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side. At line -15
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Compile(String code, Int32 errLineOffset, Boolean generateInMemory)
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner..ctor(String code, String className, String methodName, Int32 errLineOffset, Boolean generateInMemory)
at UiPath.Activities.System.Utilities.InvokeCode.CSharpInvoker.GetCompilerRunner(String code, String className, String methodName, Int32 errLineOffset, Boolean inMemory)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.GetCompilerRunner(String userCode, List`1 args, String imps, Boolean inMemory)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List`1 inArgs, IEnumerable`1 imps, Object[] args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Thanks, what is the current version of UiPath Studio that youâre using ?
Did you update UiPath Studio recently so that it could explain why it did work before ?
Studio version is 2020.10.6 Community - Stable
(EDIT sorry i got tangled with several topics with python) did you check the language of the invoke code ?
Yes, itâs Csharp.
Did you check the arguments ? Looks like either the arguments of invoke code or of the workflow have a problem (maybe at the initialization, maybe there are double values named the same way as argument and variable)
Ok, go to your files, in a path like C:\Users\...\.nuget\packages
and check inside if you see two times a folder that has the name TelemetryClient
Also, would you mind showing us your dependencies (in manage packages), do you have a double times two packages that have similar names or are using similar packages ?
Ok now if you open your json file, would you mind showing us the exact dependency used (on telemetry):
Do you have the same nupkg when you click on Manage Packages ?
I had the same issue. The following code stopped working in Invoke Code activity:
DirectoryInfo directoryInfo = new DirectoryInfo(DownloadPath);
FileInfo[] files = directoryInfo.GetFiles();
DateTime recentWrite = DateTime.MinValue;
FileInfo recentFile = null;
foreach (FileInfo file in files)
{
if (file.LastWriteTime > recentWrite)
{
recentWrite = file.LastWriteTime;
recentFile = file;
}
}
fileName = recentFile.Name;
System.IO.Stream fs = File.Open(recentFile.FullName, FileMode.Open);
System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
Error message:
No compiled code to run
error CS1704: An assembly with the same simple name 'TelemetryClient, Version=1.2.20.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side. At line -31
: at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Compile(String code, Int32 errLineOffset, Boolean generateInMemory)
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunnerâŚctor(String code, String className, String methodName, Int32 errLineOffset, Boolean generateInMemory)
at UiPath.Activities.System.Utilities.InvokeCode.CSharpInvoker.GetCompilerRunner(String code, String className, String methodName, Int32 errLineOffset, Boolean inMemory)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.GetCompilerRunner(String userCode, List1 args, String imps, Boolean inMemory) at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List
1 inArgs, IEnumerable`1 imps, Object args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
The list of dependencies:
âmainâ: âMain.xamlâ,
âdependenciesâ: {
âActivitiesUIPathIntegrationâ: â[1.0.182]â,
âMicrosoft.Activitiesâ: â[1.0.1]â,
âScrollActivityâ: â[1.0.2]â,
âUiPath.Excel.Activitiesâ: â[2.8.0-preview]â,
âUiPath.Mail.Activitiesâ: â[1.8.0-preview]â,
âUiPath.Script.Activitiesâ: â[1.0.6710.16240]â,
âUiPath.System.Activitiesâ: â[19.12.0-preview]â,
âUiPath.UIAutomation.Activitiesâ: â[20.6.0-preview]â
},
The Invoke Code activity was written in C#. The issue was resolved when the activity was rewritten in VB.net.
Hi, deleting one of the version subfolders from the .nuget/packages/*activity_package worked for me - it cannot have two. In Jenniâs example, she could delete the nuget/packages/telemetry/1.2.20
Hi ,
I had the same issue after version upgrade from 2020.10.9 to 2022.10. I upgrade UiPath.system.activities and UiPath.uiautomation.activities to the last version 22.10.4 and it works for me . In my opinion it works because UiPath.system.activities has Telemetry included as a dependencies .
( converting c# code to VB was not an option for us )
Let me know if it works for you .
i changed my code from VBNet to C# and it worked. I just translated the code from VB to C#. My previous error was: âInvoke Code: No compiled code to run
error BC31051: Namespace or type âOrg.BouncyCastle.Utilitiesâ has already been imported. At line -7â