Skip to content

Conversation

@gpanaitescu
Copy link
Contributor

@gpanaitescu gpanaitescu commented Dec 3, 2025

Added: parent activity display name, argument display name, expression text.

https://uipath.atlassian.net/browse/STUD-78425

Copy link

Copilot AI left a 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 CompiledExpressionInvoker to include the expression text
  • Implemented exception catching and enrichment logic in ActivityInstance to 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.

@gpanaitescu gpanaitescu force-pushed the fix/extend_expression_requires_compilation_exception_message branch 2 times, most recently from 7c2ecba to 9bcd19c Compare December 3, 2025 15:23
@gpanaitescu gpanaitescu requested a review from Copilot December 3, 2025 15:23
Copy link

Copilot AI left a 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;

Copy link

Copilot AI Dec 3, 2025

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)
Suggested change
// 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.

Copilot uses AI. Check for mistakes.
@gpanaitescu gpanaitescu force-pushed the fix/extend_expression_requires_compilation_exception_message branch from 9bcd19c to e4851b2 Compare December 4, 2025 11:14
…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.
@gpanaitescu gpanaitescu force-pushed the fix/extend_expression_requires_compilation_exception_message branch from e4851b2 to 565f21c Compare December 4, 2025 11:27
@gpanaitescu gpanaitescu changed the title Improve exception message for "Expression Activity type 'VisualBasicValue`1' requires compilation in order to run" Improve exception message for "Expression Activity type 'VisualBasicValue`1' requires compilation in order to run" (STUD-78425) Dec 4, 2025
}
}
catch (NotSupportedException ex) when (ex.Data.Contains(CompiledExpressionInvoker.TextExpressionMetadataRequiresCompilationKey) &&
(ex.Data[CompiledExpressionInvoker.TextExpressionMetadataRequiresCompilationKey] as bool? == true))
Copy link
Contributor

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)
Copy link
Member

@bogdanStan92 bogdanStan92 Dec 10, 2025

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

@vuplea vuplea merged commit 8681341 into develop Dec 18, 2025
6 checks passed
@vuplea vuplea deleted the fix/extend_expression_requires_compilation_exception_message branch December 18, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants