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
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-10-11 18:12 UTC by Ed Giardina
Modified: 2016-10-12 15:49 UTC (History)
1 user (show)

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


Attachments

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!

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.


Create a new report for Bug 45286 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


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.

Related Links: