This is the error that returns when trying to compile the library with “Compile Activities Expression” enabled:
Unexpected error has occurred during the library compilation process:
tem.AggregateException: One or more errors occurred. ---> UiPath.ActivityCompiler.Exceptions.VisualBasicCompilationException: The assembly compilation returned the following errors:
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Type' is not a member of 'String'.
'Type' is not a member of 'String'.
at UiPath.ActivityCompiler.CompilerV2.VisualBasicCompilerService.Emit(Stream stream, Compilation compilation, IEnumerable`1 manifestResources, LoggingScope scope)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.<>c__DisplayClass10_0.<CompileExpressions>b__0(LoggingScope expressionCompilerScope)
at UiPath.ActivityCompiler.Logging.LoggingScope.Execute(Action`1 action)
at UiPath.ActivityCompiler.Logging.LoggingManager.ExecuteExpressionsCompiler(LoggingScope parent, Action`1 action, Int32 total, String documentPath, Int32 index)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.CompileExpressions(LoggingScope scope, GenerateLibraryRequest generateLibraryRequest, GenerateActivityRequest generateActivityRequest, IEnumerable`1 expressionTrees, Int32 total, Int32& index, IEnumerable`1 references)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.<>c__DisplayClass8_0.<Build>b__1(Int32 _)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.Build(LoggingScope scope, GenerateLibraryRequest generateLibraryRequest)
at UiPath.ActivityCompiler.CommandLine.ProgramExtensions.<>c__DisplayClass3_0.<ExecuteCompilerV2DocumentsCompiler>b__0(LoggingScope documentsScope)
at UiPath.ActivityCompiler.Logging.LoggingScope.Execute(Action`1 action)
at UiPath.ActivityCompiler.Logging.LoggingManager.ExecuteCompilerV2DocumentsCompiler(LoggingScope parent, Action`1 action)
at UiPath.ActivityCompiler.CommandLine.ProgramExtensions.ExecuteCompilerV2DocumentsCompiler(LoggingScope csharpCompilerScope, GenerateLibraryRequest libraryRequest, LibraryFactory libraryFactory)
at UiPath.ActivityCompiler.CommandLine.ProgramExtensions.<>c__DisplayClass2_0.<ExecuteCompilerV2>b__0(LoggingScope csharpCompilerScope)
at UiPath.ActivityCompiler.Logging.LoggingScope.Execute(Action`1 action)
at UiPath.ActivityCompiler.Logging.LoggingManager.ExecuteCompilerV2(LoggingScope parent, Action`1 action)
at UiPath.ActivityCompiler.CommandLine.ProgramExtensions.ExecuteCompilerV2(LoggingScope scope, CompilerOptions programArgs, List`1 documents)
at UiPath.ActivityCompiler.CommandLine.Program.<>c__DisplayClass4_1.<RunCompiler>b__0(LoggingScope compilerScope)
at UiPath.ActivityCompiler.Logging.LoggingScope.Execute(Action`1 action)
at UiPath.ActivityCompiler.Logging.LoggingManager.ExecuteRunCompiler(LoggingScope parent, Action`1 action)
at UiPath.ActivityCompiler.CommandLine.Program.RunCompiler(LoggingScope mainScope, CompilerOptions programArgs)
at UiPath.ActivityCompiler.CommandLine.Program.RunCompilerWithFile(LoggingScope parentScope, StudioOptions opts)
at UiPath.ActivityCompiler.CommandLine.Program.<>c__DisplayClass2_1.<Main>b__2(StudioOptions opts)
at CommandLine.ParserResultExtensions.MapResult[T1,T2,TResult](ParserResult`1 result, Func`2 parsedFunc1, Func`2 parsedFunc2, Func`2 notParsedFunc)
at UiPath.ActivityCompiler.CommandLine.Program.<>c__DisplayClass2_0.<Main>b__0(LoggingScope scope)
> (Inner Exception #0) UiPath.ActivityCompiler.Exceptions.VisualBasicCompilationException: The assembly compilation returned the following errors:
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
'Environment' is not a member of 'String'.
'Environment' is not a member of 'String'.
'Type' is not a member of 'String'.
'Type' is not a member of 'String'.
at UiPath.ActivityCompiler.CompilerV2.VisualBasicCompilerService.Emit(Stream stream, Compilation compilation, IEnumerable`1 manifestResources, LoggingScope scope)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.<>c__DisplayClass10_0.<CompileExpressions>b__0(LoggingScope expressionCompilerScope)
at UiPath.ActivityCompiler.Logging.LoggingScope.Execute(Action`1 action)
at UiPath.ActivityCompiler.Logging.LoggingManager.ExecuteExpressionsCompiler(LoggingScope parent, Action`1 action, Int32 total, String documentPath, Int32 index)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.CompileExpressions(LoggingScope scope, GenerateLibraryRequest generateLibraryRequest, GenerateActivityRequest generateActivityRequest, IEnumerable`1 expressionTrees, Int32 total, Int32& index, IEnumerable`1 references)
at UiPath.ActivityCompiler.CompilerV2.LibraryFactory.<>c__DisplayClass8_0.<Build>b__1(Int32 _)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---