Bug 41575 - A Method That Accepts a FormattableString Object Is Not Called
Summary: A Method That Accepts a FormattableString Object Is Not Called
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.4.0 (C7)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2016-06-07 22:38 UTC by Jimmy [MSFT]
Modified: 2016-06-09 16:03 UTC (History)
1 user (show)

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

repro project (15.85 KB, application/zip)
2016-06-07 22:38 UTC, Jimmy [MSFT]
Mono IL Code (6.59 KB, text/plain)
2016-06-07 22:58 UTC, Jimmy [MSFT]
Windows IL Code (8.45 KB, text/plain)
2016-06-07 22:59 UTC, Jimmy [MSFT]

Description Jimmy [MSFT] 2016-06-07 22:38:59 UTC
Created attachment 16221 [details]
repro project

### Overview
If your code includes a call to a method that takes a FormattableString object, when the code is ran, the method will not be called. This happens when it is compiled in XS on the Mac. Running the same code compiled with VS2015 does not have this issue. Looking at the IL code, the compiler seems to completely omit any call to the method (IL code from Windows and Mac exes attached).

Also, adding additional scoping to sections of code with a call to the same method as above will result in the entire block of code being excluded. See the commented out code in the repro project for an example of this.

### Steps to Reproduce
1. Run the attached repro project on XS 6.0

### Expected Results
The debug output should be:

Case 1
Case 2
Case 3

### Actual Results
The debug output is:

Case 2

### Environment Info
=== Xamarin Studio Business ===

Version 6.0 (build 5174)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
	Mono 4.4.0 (mono-4.4.0-branch-c7-baseline/5995f74) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000182

=== Xamarin.Profiler ===

Version: 0.33.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.Mac ===

Version: (Xamarin Business)

=== Xamarin.Android ===

Version: (Xamarin Business)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: (Xamarin Business)
Hash: 39ebb77
Branch: cycle7
Build date: 2016-06-01 21:23:15-0400

=== Build Information ===

Release ID: 600005174
Git revision: 694a75f040b7f2309bc43d4f78a3a6572ca898bf
Build date: 2016-06-01 17:28:08-04
Xamarin addins: 33f406fa2dcf214012c78cb846585f062b2e1d24
Build lane: monodevelop-lion-cycle7-baseline

=== Operating System ===

Mac OS X 10.11.5
Darwin Jimmys-MacBook-Pro.local 15.5.0 Darwin Kernel Version 15.5.0
    Tue Apr 19 18:36:36 PDT 2016
    root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Comment 1 Jimmy [MSFT] 2016-06-07 22:58:55 UTC
Created attachment 16223 [details]
Mono IL Code
Comment 2 Jimmy [MSFT] 2016-06-07 22:59:11 UTC
Created attachment 16224 [details]
Windows IL Code
Comment 3 Marek Safar 2016-06-09 16:03:29 UTC
Fixed in master and mono 4.5.1

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the 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.

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