Invoke Code Always Fails: Method Not Found

Can someone tell me why this fails?

  1. Create a new sequence and add an invoke code activity.
  2. Code:
    Dim testDate As DateTime = #3/12/1999#
    Dim testString As String = FormatDateTime(testDate, DateFormat.LongDate)
  3. According to the Microsoft documentation, FormatDateTime is in the Microsoft.VisualBasic namespace.
  4. Verify that Microsoft.VisualBasic appears in the workflow’s Imported Namespaces list.
  5. Run the file. Output error: method not found

test.xaml: 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)’.

Except for the simplest possible examples, I can never get invoke code to work, even though:

  1. My UIPath is set to use and
  2. The required namespace is always in the workflow’s namespace list.

Much obliged for any assistance.


I have faced the same exception while executing invoke code activity. I have resolved it by downgrading my uipath.system package to lower version from latest. Some how the latest system package is not able to compile the vb code and throwing exception related to syntax tree. Try and let me know. Thanks.

@Kir thanks for your reply.

  1. Do you mean the uipath.system.activities package?
  2. Can you tell me what version of the uipath.system.activities package worked for you?

Thank you,


Yes Uipath.system.activities package.

→ latest 2021.10.3 downgrade to 2021.10.2 it should work. for me this package version not giving me any error.

i have little bit confused i have tried with two version 2021.10.2 and 21.4.1 either one of the package version helped me to resolve the issue. try both versions and let me know. thanks.

@Kir - thanks for your help, however:

  1. Uninstall uipath.system.activities 21.10.3.
  2. Reboot UIPath studio.
  3. Install alternate package version.

Using uipath.system.activities 21.10.2
Method not found error; same error as with package version 21.10.3

Using uipath.system.activities 21.4.1
test.xaml: No compiled code to run
error BC30561: ‘DateFormat’ is ambiguous, imported from the namespaces or types ‘UiPath.Excel.Activities.Business, UiPath.Core.Activities, Microsoft.VisualBasic’. At line 2


I am sure this is related to the method which are trying to use both the Excel and other name spaces that made it ambiguous. Please remove the namespace if you added any new for this invoke code activity. Sure it will work. I think uipath.system.activity 21.4.1 resolve the syntax tree error.

@Kir - I appreciate your help, but:

UIPath.system.activities version 21.4.1

Namespaces in the workflow (after a remove all unused):

Error message:
test2.xaml: No compiled code to run
error BC30561: ‘DateFormat’ is ambiguous, imported from the namespaces or types ‘UiPath.Core.Activities, Microsoft.VisualBasic’. At line 2

I’ve tried adding the Microsoft.VisualBasic namespace, but the same error occurs.


Hello, please check if the project your created was in vb or c#. Try checking below page:

Hi @kirankumar.mahanthi1 ,
It doesnt work even if I downgrade my UiPath.System.Activities package.
Still populate same error “Method Not Found:Microsoft.CodeAnalysis.SyntaxTree”.
Can anyone help?