Library Compile Error after upgrading to 20.10

Since u upgraded Studio to 20.10, Im getting the following error.

Main.xaml: The private implementation of activity 'XXX' has the following validation error:   Compiler error(s) encountered processing expression "System.Environment.CurrentDirectory". 'Environment' is not a member of 'String'.

First it appeared when trying to compile a library, I fix that disabling the option “Compile Activities Expression” in the library properties.

After that, when importing the library to a process, the same error happens, but now is when invoking a single library activity, only this one activity is giving me this error.
First I was thinking is something related to the new design experience, but doesnt looks to be the case, since it’s not the only acitivity that uses it.

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 )<---

Hi @lucas.stern

Is it still an issue for you?

Hi, we have same error, how have you resolved?

Hey @lucas.stern @michele_piccolo

Would it be possible to provide a bundle of a sample project/library (as a zip) that reproduces this issue? It would help a lot.

Unfortanelly i cant anymore, since this problem was happening only on 20.10.
I handle it by avoiding putting dot (.) on my libraries names.
Now, on 22.4 the error does not occur anymore.

1 Like

Thank you for reporting back on this. It is very much possible that our team picked it up in the meantime and actually fixed the issue for 22.4.

But let us know in case the issue manifests itself again :slight_smile:

In fact, i guess it was fixed on 21.4 or 21.10. Has been a while since i got this problem.

1 Like

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