Open
Description
π What did you see?
The following exception is thrown:
Message:β
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:β
GherkinLine.GetLineText(Int32 indentToRemove)
Token.GetTokenValue()
...
β What did you expect to see?
Either:
- A suitable default value such as an empty string or
null
. - An exception that indicates it's not valid to call
GetLineText(...)
π¦ Which tool/library version are you using?
.NET 8 with Gherkin 32.0.0
π¬ How could we reproduce it?
The following snippet demonstrates the problem:
default(GherkinLine).GetLineText(0);
π Any additional context?
It looks like a recent change switched GherkinLine
from a class to a struct: cf4160f#diff-150d7921f11609b895fc571d0916916563d77bc54d723e6086890c2efb626e34
Structures in C# are stack-initialized and therefore should be valid without a constructor being called - i.e. it should be possible to identify an instance is the default value and handle it appropriately, both as an external caller and in the internal implementation.
Metadata
Metadata
Assignees
Labels
No labels
Activity