Closed
Description
If operator ==(Token left, Token right)
or operator !=(Token left, Token right)
is called such that left
is null, then it throws NullReferenceException because it tries to call left.Equals(right)
.
command-line-api/src/System.CommandLine/Parsing/Token.cs
Lines 63 to 77 in 209b724
That happened in my app, which compared optionResult.Token != null
as part of the #1795 (comment) implementation. I'll be able to work around the bug by using !object.ReferenceEquals(optionResult.Token, null)
instead.
No other types in System.CommandLine define comparison operators that could have similar bugs.
Metadata
Metadata
Assignees
Labels
No labels