question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing exception while using 'as' operator

See original GitHub issue

I’m trying to use following expression:

string.IsNullOrEmpty(variable as string)

but it results with exception: DynamicExpresso.Exceptions.ParseException: ‘)’ or ‘,’ expected (at index 40).

Adding extra parenthesis as message suggests solves the issue, but the expression is obviously wrong then string.IsNullOrEmpty(variable as string))

Seems there is something wrong with parser.

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
metoulecommented, Jun 10, 2023

@IAMJDA thanks for narrowing it down! It’s indeed a regression in the way the types are parsed: we don’t reset the parser position properly if the type has no modifier. I’ll need to ensure it’s working for all the possible type modifiers. For example:

string?
string?[]
string?[][]
IEnumerable<string>
IEnumerable<string?[]>?[]

but it shouldn’t take too long 🤞

1reaction
IAMJDAcommented, Jun 9, 2023

Manual bisect:

  • 2.9.5 fails
  • 2.9.4 works

#178 seems to be to blame

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception thrown when parsing data - java
Edit 1: Problem with the code was that the input was in the format ddMMyyyy(06071994) and the format was dd MM yyyy (should...
Read more >
Caught parsing exception during wrapDescribeOperator()
My job is a very basic DB2 connector connecting to an open systems DB2 systems; running SQL contained within a file. The result...
Read more >
Parsing and Exceptions - JSON for Modern C++
The parse() function accepts a bool parameter allow_exceptions which controls whether an exception is thrown when a parse error occurs ( true ,...
Read more >
Exceptions - Java Programming MOOC
The user input, in this case the string no! , is given to the Integer.parseInt method as a parameter. The method throws an...
Read more >
How to Solve Class Cast Exceptions in Java?
This exception is rise automatically by JVM whenever we try to improperly typecast a class from one type to another i.e when we're...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found