C# syntax highlighting issue with a verbatim string ending with a backslash (fixed)

C# syntax highlighting issue with a verbatim string ending with a backslash (fixed)

1

    Jan 15, 2018#1

    Hello all,

    I'm using UE 24.xx on Windows with the csharp.uew wordfile. I have a problem with a string containing a trailing backslash. When such a string is encountered, the remainder of the file gets interpreted for highlighting purposes as part of the string.

    Example:

    fileName = Path.Combine(@"..\logs\", fileName);

    The red formatted part is also highlighted as string although not belonging to the verbatim string.

    If I remove the last backslash then the highlighting is correct. I even tried changing to :

    fileName = Path.Combine(@"..\logs" + "\", fileName);

    with no effect.

    6,686585
    Grand MasterGrand Master
    6,686585

      Jan 15, 2018#2

      The second example is definitely coded wrong as the line should be:

      fileName = Path.Combine(@"..\logs" + "\\", fileName);

      But you are absolutely right about first line. The verbatim string highlighting is wrong with a backslash at end of the string. I verified that wrong highlighting with UE v24.20.0.51 and v22.20.0.49.

      The description of String Literal Prefix on Syntax Highlighting help page is correct and fits with the verbatim string literals definition in MSDN.

      This issue is definitely a syntax highlighting bug of UltraEdit. Please report it by email to UltraEdit support to get it fixed in a future version of UltraEdit as I have done too.

        Oct 05, 2018#3

        This issue is fixed with UltraEdit for Windows v25.20.0.88 released on 2018-10-03.
        Best regards from an UC/UE/UES for Windows user from Austria

        2
        NewbieNewbie
        2

          19:26 - 8 days ago#4

          Hello,

          I am using UltraEdit for Windows v2024.1.0.36 64-bit. Same issue that OP described above years ago: when editing a C# code file, the syntax highlighting gets stuck in "string" highlight mode after the first occurrence of a string ending with an odd number of backslash characters (1, 3, 5 etc) even if the string is using the verbatim token @. See screenshot. Is this a returning bug, or is there a newer/better version of the C# syntax template available?

          Thanks,
          Mark
          c# loses proper syntax highlighting after string with trailing backslash.png (16.58KiB)

          6,686585
          Grand MasterGrand Master
          6,686585

            6:26 - 8 days ago#5

            This is again a syntax highlighting bug as it looks like the String Literal Prefix = definition in the syntax highlighting wordfile is completely ignored on applying the syntax highlighting on verbatim strings. Please report this issue by email to UltraEdit support or with the technical support form.

            The verbatim string syntax highlighting works fine according to my tests up to version 2023.0.0.41 (v30.0.0.41 in former version numbering scheme). The next public released version 2023.0.0.50 syntax highlights the same verbatim string in same C# file wrong in comparison to version 2023.0.0.41 and former versions used by me for finding out in which version this syntax highlighting bug came back. I recommend adding this information to the issue report as it helps the UltraEdit developers finding out where the code mistake is.
            Best regards from an UC/UE/UES for Windows user from Austria

            2
            NewbieNewbie
            2

              14:06 - 7 days ago#6

              Thanks Mofi for the response and information. I'll get this reported.