Null coalescing operator sometimes doesn't work

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 4 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 4 years ago]

Comments (1)

Answer - Posted 4 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 (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.