Invoke Code Issue - Method not found: 'Microsoft.CodeAnalysis.SyntaxTree

Hi All,

I am trying to close Active excel file using invoke code activity but getting below error.

Method not found: ‘Microsoft.CodeAnalysis.SyntaxTree Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxTree.ParseText(System.String, Microsoft.CodeAnalysis.VisualBasic.VisualBasicParseOptions, System.String, System.Text.Encoding, System.Collections.Immutable.ImmutableDictionary`2<System.String,Microsoft.CodeAnalysis.ReportDiagnostic>, System.Threading.CancellationToken)’.

image


image

I am using Studio 2020.10.4 and UiPath.System.Activites 21.10.3 version also imported names spaces.

Could you please help me understand what is missing in my solution and how can I overcome this issue.

1 Like

Hi,

Please refer the below post at the end our forum members discussed on this issue. the temporary solution would be downgrading the System.Activities package to 20.10.4 resolve the issue. please try downgrade the system activity package and let us know. Thanks.

Hi @kirankumar.mahanthi1

I tired that one but it’s not working for me.
Getting below error.

Hi,

Can you try to update Excel package to the latest?

Regards,

Hi @snehal23 ,

Did you install the microsoft.office.interop.excel package in your studio. Please confirm. Thanks.

Yes, I already installed it but still getting this issue

image

I am using Excel package of 2.11.4 this version

Hi,
Can you try to define it as not Microsoft.Office.Interop.ExcelApplication but Microsoft.Office.Interop.Excel.Application ?
(And also Microsoft.Office.Interop.Excel.Workbook)

Regards,

Hi,

i think it is coding error you have to define the excel object like below and it will work. Thanks.

Dim excelApp As Microsoft.Office.Interop.Excel.Application

Dim wb As Microsoft.Office.Interop.Excel.Workbook

excelApp = New Microsoft.Office.Interop.Excel.ApplicationClass

wb= excel.Workbooks.Open(“Your excel workbook Path”)

excelApp.Visible=False.

wb.close

Did we found a permanent solution? Issue is because when I downgrade the version of System.Activities to 20.10.4, my other functionalities stops working. Need help on this as soon as possible.

1 Like

I have the same problem.
If you got a solution to this problem. Could you tell me…
Thank you very much!!!

Yes, I found the solution.
It will not help if you downgrade the package as we have other dependencies.
Try to install below package it will resolve the issue.

Note: The above solution will work till 21.4.1 version of UiPath System.Activities after that it will not work, kindly take a note of it.
image

Yes, I found the solution.
Try to install below package it will resolve the issue.

Note: The above solution will work till 21.4.1 version of UiPath System.Activities after that it will not work, kindly take a note of it.

image

We need to add two things in our Main.xaml file.
I tried to import name space but it didn’t work then I manually updated Main.xaml file as below.
Once you update Main.xaml no need to import any name space or install any package.
I believe it will work for all versions of UiPath.System.Activities.
I am working on 21.10.4 version of UiPath.System.Activities and it is working fine for me.

Add under <TextExpression.NamespacesForImplementation>

Add this ::
<x:String>System.Reflection</x:String>
<x:String>System.Runtime.InteropServices</x:String>

For detail check attached screenshot

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