Null coalescing operator sometimes doesn't work

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 2 years ago by Marc Beeson - Precision Mining
Version: 20.1.0400
Platform: .NET 4.6
Environment: Windows 10 (64-bit)

Using the C# Editor sample in the .Net Languages Add-on Demos of the Sample Browser app. If I use the following code snippet the line with '(a ?? "").Trim();' gets picked up as an error. However wrapping the null coalescing statement in another parenthesis group clears the error.

string a = null;
Console.WriteLine((a ?? "").ToString());
(a ?? "").Trim();
((a ?? "")).Trim();

The code snippet is redundant, but highlights the issue.

[Modified 2 years ago]

Comments (1)

Answer - Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Marc,

Thanks for letting us know about this.  It appears it was incorrectly triggering a can-match in our grammar for a tuple type production start.  We've fixed this for the next maintenance release.

Actipro Software Support

The latest build of this product (v21.1.1) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.