-
Notifications
You must be signed in to change notification settings - Fork 227
Improve exception message for "Expression Activity type 'VisualBasicValue`1' requires compilation in order to run" (STUD-78425) #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances exception messages when expressions require compilation but haven't been compiled. The improvement adds contextual information including parent activity display name, argument display name, and expression text to help developers better diagnose compilation issues.
Key changes:
- Added a marker key to identify compilation-related exceptions using the exception's Data dictionary
- Enhanced the exception message in
CompiledExpressionInvokerto include the expression text - Implemented exception catching and enrichment logic in
ActivityInstanceto prepend activity and argument context
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/UiPath.Workflow.Runtime/Expressions/CompiledExpressionInvoker.cs |
Adds exception marker key and includes expression text in the error message |
src/UiPath.Workflow.Runtime/ActivityInstance.cs |
Catches marked compilation exceptions and enriches them with activity/argument context using a new helper method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/UiPath.Workflow.Runtime/Expressions/CompiledExpressionInvoker.cs
Outdated
Show resolved
Hide resolved
7c2ecba to
9bcd19c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| return completedSynchronously; | ||
|
|
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CreateArgumentErrorMessage local function lacks documentation. Given its role in constructing user-facing error messages with specific formatting (owner display name, argument display name, and exception message), it would benefit from a documentation comment explaining:
- Its purpose
- The format of the returned message
- How null or empty values are handled
Consider adding a comment like:
// Creates an enriched error message by prepending the owner display name and argument display name
// to the original exception message. Format: "[OwnerDisplayName: ][ArgumentDisplayName ]ExceptionMessage"
static string CreateArgumentErrorMessage(RuntimeArgument argument, Exception exception)| // Creates an enriched error message by prepending the owner display name and argument display name | |
| // to the original exception message. Format: "[OwnerDisplayName: ][ArgumentDisplayName ]ExceptionMessage" | |
| // If the argument is null, returns only the exception message. Owner and argument display names are omitted if null or empty. |
9bcd19c to
e4851b2
Compare
…alue`1' requires compilation in order to run. Please ensure that the workflow has been compiled." Added: parent activity display name, argument display name, expression text.
e4851b2 to
565f21c
Compare
| } | ||
| } | ||
| catch (NotSupportedException ex) when (ex.Data.Contains(CompiledExpressionInvoker.TextExpressionMetadataRequiresCompilationKey) && | ||
| (ex.Data[CompiledExpressionInvoker.TextExpressionMetadataRequiresCompilationKey] as bool? == true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we know that if the key is present, the value is always true, maybe just check the key
| private readonly MetadataReference[] _references; | ||
| public Project(MetadataReference[] references) => _references = references; | ||
| public async Task<Type> Compile(string classCode, string className) | ||
| public async Task<Type> Compile(string classCode, string className, Language language) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a problem (it was present before) - when trying to run Compile multiple times (e.g. using theory instead of fact).
AssembyLoad will fail (Assembly with same name is already loaded).
I am not saying that we should fix this now (or maybe never), but we need to be aware of the problem
Added: parent activity display name, argument display name, expression text.
https://uipath.atlassian.net/browse/STUD-78425