Skip to content
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

Throw ArgumentException when expression has invalid compare (e.g. string with int) #851

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

StefH
Copy link
Collaborator

@StefH StefH commented Oct 30, 2024

Modified #if directive in NotNullWhenAttribute.cs to include NETSTANDARD2_0 and remove NETSTANDARD1_3_OR_GREATER. Updated GenerateStaticMethodCall in ExpressionHelper.cs to use TryGetStaticMethod instead of GetStaticMethod, throwing an ArgumentException if the method is not found. Replaced GetStaticMethod with TryGetStaticMethod in ExpressionHelper.cs. Added MyView class with nullable Properties dictionary to ExpressionParserTests.cs. Added Parse_InvalidExpressionShouldThrowArgumentException test to verify ArgumentException is thrown for invalid expressions.

Modified `#if` directive in `NotNullWhenAttribute.cs` to include `NETSTANDARD2_0` and remove `NETSTANDARD1_3_OR_GREATER`. Updated `GenerateStaticMethodCall` in `ExpressionHelper.cs` to use `TryGetStaticMethod` instead of `GetStaticMethod`, throwing an `ArgumentException` if the method is not found. Replaced `GetStaticMethod` with `TryGetStaticMethod` in `ExpressionHelper.cs`. Added `MyView` class with nullable `Properties` dictionary to `ExpressionParserTests.cs`. Added `Parse_InvalidExpressionShouldThrowArgumentException` test to verify `ArgumentException` is thrown for invalid expressions.
@StefH StefH self-assigned this Oct 30, 2024
@StefH StefH added the bug label Oct 30, 2024
@StefH StefH changed the title Throw ArgumentException when expression had invalid compare (e.g. string with int) Throw ArgumentException when expression has invalid compare (e.g. string with int) Oct 30, 2024
@StefH StefH merged commit f42dfb6 into master Oct 31, 2024
7 checks passed
@StefH StefH deleted the bug/849 branch October 31, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

1 participant