Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dotnet/src/Plugins/Plugins.Web/Brave/BraveTextSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,10 @@ private static void ExtractMethodCallClause(MethodCallExpression methodCall, Lis
System.Reflection.PropertyInfo property => property.GetValue(constantExpr.Value),
_ => null
},
_ => Expression.Lambda(expression).Compile().DynamicInvoke()
_ => throw new NotSupportedException(
$"Unable to extract value from expression of type '{expression.GetType().Name}'. " +
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other exceptions in this file (which report expression.NodeType), consider using expression.NodeType here instead of expression.GetType().Name. It tends to be a clearer indicator of what expression shape was rejected and matches the rest of the expression-analysis error messages.

Suggested change
$"Unable to extract value from expression of type '{expression.GetType().Name}'. " +
$"Unable to extract value from expression of node type '{expression.NodeType}'. " +

Copilot uses AI. Check for mistakes.
"Only constant expressions and simple member access are supported for AOT compatibility. " +
"Expression: " + expression)
Comment thread
markwallace-microsoft marked this conversation as resolved.
};
}

Expand Down
5 changes: 4 additions & 1 deletion dotnet/src/Plugins/Plugins.Web/Tavily/TavilyTextSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,10 @@ private static void ExtractMethodCallClause(MethodCallExpression methodCall, Lis
System.Reflection.PropertyInfo property => property.GetValue(constantExpr.Value),
_ => null
},
_ => Expression.Lambda(expression).Compile().DynamicInvoke()
_ => throw new NotSupportedException(
$"Unable to extract value from expression of type '{expression.GetType().Name}'. " +
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other exceptions in this file (which report expression.NodeType), consider using expression.NodeType here instead of expression.GetType().Name. NodeType will more directly identify unsupported patterns (e.g., Call, MemberAccess, Convert) and makes troubleshooting easier.

Suggested change
$"Unable to extract value from expression of type '{expression.GetType().Name}'. " +
$"Unable to extract value from expression of type '{expression.NodeType}'. " +

Copilot uses AI. Check for mistakes.
"Only constant expressions and simple member access are supported for AOT compatibility. " +
"Expression: " + expression)
Comment thread
markwallace-microsoft marked this conversation as resolved.
};
}

Expand Down
Loading