Bug 45286 - C# string interpolation line does not compile on OSX but does on MSBuild
Summary: C# string interpolation line does not compile on OSX but does on MSBuild
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2016-10-11 18:12 UTC by Ed Giardina
Modified: 2016-10-12 15:49 UTC (History)
1 user (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Ed Giardina 2016-10-11 18:12:27 UTC
Description of Problem:

I've got some string interpolation code that compiles in MSBuild on Windows but not on Mac OSX Sierra

public static string SanitizeCsv(string field)
            return string.IsNullOrEmpty(field)
              ? string.Empty
              : $"\"{field.Replace("\"", "\\\"").Replace("\n", "\\n")}\"";

Steps to reproduce the problem:
1. Author the above function
2. Code will fail to build

Actual Results:
Return compiler error on the : $" line with
Error CS8076: Missing close delimiter `}' for interpolated expression (CS8076) (Core)

Expected Results:
Code to compile

How often does this happen? 
Every build

Additional Information:
Mono JIT compiler version 4.6.1
Xamarin Studio Community 6.1.1 build 15
Comment 1 Marek Safar 2016-10-12 15:37:22 UTC
Fixed in master and Mono 4.8
Comment 2 Ed Giardina 2016-10-12 15:49:30 UTC
Thank you Marek, the turnaround time was amazing! Litmus owes you a beer if you are ever in the Boston area!

Note You need to log in before you can comment on or make changes to this bug.