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

Null reference exception message surfacing from Evaluate #137

Open
Mark-A-Williams opened this issue Jan 12, 2024 · 1 comment
Open

Null reference exception message surfacing from Evaluate #137

Mark-A-Williams opened this issue Jan 12, 2024 · 1 comment

Comments

@Mark-A-Williams
Copy link

Describe the bug

Certain expressions, seemingly those that have a negative sign followed by nothing (or perhaps other operators), throw an ExpressiveException the content of which is 'Object reference not set to an instance of an object.'. While obviously such an expression is not valid, and should throw some sort of exception, I'd expect it to be something a bit more user friendly. E.g. "The right hand side of the operation is missing".

To Reproduce

The extremely minimal repro of this is the following code.

using Expressive;
var expression = new  Expression("-");
expression.Evaluate();

More generally, seems to be for any operator that doesn't require a left hand side, when the right hand side is missing. E.g. ! or + as well as -.

Expected behavior

A more user friendly message explaining why the formula is invalid.

Screenshots

image

Platform (please complete the following information):
Seen on Windows, .NET 8 app, ExpressiveParser version 2.5.0

Additional context
Add any other context about the problem here.

@bijington
Copy link
Owner

Oh yeah that is a great find thanks! I would have expected a very similar error message to what you stated in your report.

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

No branches or pull requests

2 participants