External C# Script: Unrecognized escape sequence

Discussion in 'Call Flow Designer' started by DolbySR, Jul 5, 2017.

Thread Status:
Not open for further replies.
  1. DolbySR

    Joined:
    Jul 13, 2016
    Messages:
    9
    Likes Received:
    0
    Hey guys!

    Just switched to the newest VAD Version and I was trying to start again with a truly simple project. When trying to build, I get this error:

    Compiling file Main.flow ([Path omitted]\Main.flow)...
    Creating source code output...
    Compiling the created source code to .NET library...
    Error compiling source code to .NET library: (119,61): error CS1009: Unrecognized escape sequence
    Error compiling source code to .NET library: (119,67): error CS1009: Unrecognized escape sequence
    Error compiling source code to .NET library: (119,74): error CS1009: Unrecognized escape sequence
    Error compiling source code to .NET library: (119,84): error CS1009: Unrecognized escape sequence
    Error compiling source code to .NET library: (119,98): error CS1009: Unrecognized escape sequence

    ----- Build process finished for project '[Name omitted]'.

    Anyone had this problem?

    EDIT: I noticed that the external C# script doesn't seem to be the culprit... It happens with or without it.

    Regards
    Patrick
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,361
    Likes Received:
    109
    Hello @DolbySR,

    Please take a look at this troubleshooting guide:
    https://www.3cx.com/docs/manual/cfd-troubleshooting/

    In this case, the problem is that the C# code generated can't be compiled to a DLL. The "Unrecognized escape sequence" is related to a string containing back slash "\" (which is the escape character in C#), followed by a characted that is not a valid escape sequence.

    For example, "\n" means "new line", "\t" means the tab character, and so on. Here you have all the options:
    https://msdn.microsoft.com/en-us/library/h21280bw.aspx

    This is a very common error when you try to specify a file path. For example:
    "C:\Path\To\My\Text\File.txt"

    In that case, each back slash is considered an escape character, and the following character must be one from the list. If you don't want that, you need to escape the back slash, using a double back slash:
    "C:\\Path\\To\\My\\Text\\File.txt"

    Another option is using a verbatim string, just adding the @ character as a prefix:
    @"C:\Path\To\My\Text\File.txt"

    That @ prefix will tell the compiler that the string doesn't contain escape sequences, just plain text.

    Hope the information helps.

    Kind regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.