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# ()
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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

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!