Bug 46203 - mcs produces different code resulting in failure of reflection test
Summary: mcs produces different code resulting in failure of reflection test
Status: RESOLVED FEATURE
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: All Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-11-01 10:06 UTC by Neale Ferguson
Modified: 2016-11-01 14:47 UTC (History)
1 user (show)

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


Attachments
Test case - compile under 4.4 versus master/4.8/... (7.04 KB, text/plain)
2016-11-01 10:06 UTC, Neale Ferguson
Details


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:
Status:
RESOLVED FEATURE

Description Neale Ferguson 2016-11-01 10:06:41 UTC
Created attachment 18283 [details]
Test case - compile under 4.4 versus master/4.8/...

Compiling the test case attached to this bug report generates different code on 4.4 than on 4.8 and above (not sure about 4.6). THe program runs under 4.4 and on .NET but results in the following on, as in this example, on master:

Unhandled Exception:
System.Exception: should have returned 10 fields, onlly returned 5
  at test3.MainClass.Main (System.String[] args) [0x0008f] in <0473511e3bae4c1ba947fc2b0feabcd8>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: should have returned 10 fields, onlly returned 5
  at test3.MainClass.Main (System.String[] args) [0x0008f] in <0473511e3bae4c1ba947fc2b0feabcd8>:0 

It appears mcs generates different IL than it used to.
Comment 1 Marek Safar 2016-11-01 11:09:37 UTC
This is inline with Roslyn changes. csc now generates CompilerGeneratedAttribute for more private fields.
Comment 2 Neale Ferguson 2016-11-01 13:43:55 UTC
Are you saying that this test case which currently works under .NET will soon break as the .NET stack updates its compilers?
Comment 3 Marek Safar 2016-11-01 14:40:48 UTC
This tests is already broken as VS2015 was released with Roslyn so it fails with latest released .net too
Comment 4 Neale Ferguson 2016-11-01 14:45:12 UTC
Thanks, that is good to know. Is there a reference to the Roslyn change so I can show the developer what has changed?
Comment 5 Marek Safar 2016-11-01 14:47:34 UTC
I don't know about specific Roslyn commit which changed that but it's pretty easy to test