Squiggle display of errors for switch expression

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 11 months ago by Luke
Version: 23.1.0
Platform: .NET 6.0
Environment: Windows 11 (64-bit)
Avatar

Hi, We are using the CSharpSyntaxLanguage provided and having similar code snippets shown below. We've then encountered an issue that squiggle display of errors appear on the line for the default. If I replace the throw exception part with some string value, it would then happy. I believe that syntax is part of C# 8.0, which should be fully supported by the SyntaxEditor, do I miss anything or maybe there's some extra setup required?

    int testBit;
    string result = testBit switch
    {
        0 => "P",
        1 => "F",
        _ => throw new Exception()
    };

Comments (1)

Posted 11 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Luke,

You're absolutely correct about using a throw expression there. We were able to identify and fix the issue in the C# grammar for our next maintenance release. Thank you for reporting the issue and providing a clear example for how to reproduce it.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.