Skip to content

Commit

Permalink
Merge pull request #281 from UiPath/fix/validation-error
Browse files Browse the repository at this point in the history
Fix validation errors [STUD-65311] [STUD-65835]
  • Loading branch information
aoltean16 authored Sep 13, 2023
2 parents 731854f + 2e6b0da commit bd19569
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/UiPath.Workflow/Validation/CSharpExpressionValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace System.Activities.Validation;
public class CSharpExpressionValidator : RoslynExpressionValidator
{
private static readonly Lazy<CSharpExpressionValidator> s_instance = new(() => new(s_defaultReferencedAssemblies));
private const string _valueValidationTemplate = "public static Expression<Func<{0}>> CreateExpression{1}() => ({2}) => {3};//activityId:{4}";
private const string _delegateValueValidationTemplate = "{0}\npublic static Expression<{1}<{2}>> CreateExpression{3}() => ({4}) => {5};//activityId:{6}";
private const string _valueValidationTemplate = "public static System.Linq.Expressions.Expression<System.Func<{0}>> CreateExpression{1}() => ({2}) => {3};//activityId:{4}";
private const string _delegateValueValidationTemplate = "{0}\npublic static System.Linq.Expressions.Expression<{1}<{2}>> CreateExpression{3}() => ({4}) => {5};//activityId:{6}";
private const string _referenceValidationTemplate = "public static {0} IsLocation{1}() => ({2}) => {3} = default({4});//activityId:{5}";

private static readonly CompilerHelper s_compilerHelper = new CSharpCompilerHelper();
Expand Down
8 changes: 4 additions & 4 deletions src/UiPath.Workflow/Validation/VBExpressionValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class VbExpressionValidator : RoslynExpressionValidator
private static readonly Lazy<VbExpressionValidator> s_instance = new(() => new(s_defaultReferencedAssemblies));
private static readonly CompilerHelper s_compilerHelper = new VBCompilerHelper();

private const string _valueValidationTemplate = "Public Shared Function CreateExpression{0}() As Expression(Of Func(Of {1}))'activityId:{4}\nReturn Function({2}) ({3})'activityId:{4}\nEnd Function";
private const string _delegateValueValidationTemplate = "{0}\nPublic Shared Function CreateExpression{1}() As Expression(Of {2}(Of {3}))'activityId:{6}\nReturn Function({4}) ({5})'activityId:{6}\nEnd Function";
private const string _referenceValidationTemplate = "Public Shared Function IsLocation{0}() As {1}'activityId:{4}\nReturn Function({2}) as Action'activityId:{3}\nReturn Sub() {3} = CType(Nothing, {4})'activityId:{5}\nEnd Function'activityId:{4}\nEnd Function";
private const string _valueValidationTemplate = "Public Shared Function CreateExpression{0}() As System.Linq.Expressions.Expression(Of System.Func(Of {1}))'activityId:{4}\nReturn Function({2}) ({3})'activityId:{4}\nEnd Function";
private const string _delegateValueValidationTemplate = "{0}\nPublic Shared Function CreateExpression{1}() As System.Linq.Expressions.Expression(Of {2}(Of {3}))'activityId:{6}\nReturn Function({4}) ({5})'activityId:{6}\nEnd Function";
private const string _referenceValidationTemplate = "Public Shared Function IsLocation{0}() As {1}'activityId:{5}\nReturn Function({2}) as System.Action'activityId:{5}\nReturn Sub() {3} = CType(Nothing, {4})'activityId:{5}\nEnd Function'activityId:{5}\nEnd Function";

private static readonly VisualBasicParseOptions s_vbScriptParseOptions =
new(kind: SourceCodeKind.Script, languageVersion: LanguageVersion.Latest);
Expand Down Expand Up @@ -113,7 +113,7 @@ protected override string CreateValueCode(string types, string names, string cod
protected override string CreateReferenceCode(string types, string names, string code, string activityId, string returnType, int index)
{
var actionDefinition = !string.IsNullOrWhiteSpace(types)
? $"Action(Of {string.Join(Comma, types)})"
? $"Action(Of {string.Join(Comma, types)})"
: "Action";
return string.Format(_referenceValidationTemplate, index, actionDefinition, names, code, returnType, activityId);
}
Expand Down

0 comments on commit bd19569

Please sign in to comment.