When compiling this code:
using System;
public class Test
{
public static void Main()
{
Console.WriteLine(nameof(A.X));
Console.WriteLine(nameof(A.Y)); // works fine, but shouldn't
}
}
public class A
{
public int X;
private int Y {get; set;}
}
The Roslyn compiler fails with:
> error CS0122: 'A.Y' is inaccessible due to its protection level
The mcs compiler (I have tried the latest version from the download.mono-project.com repo on Ubuntu, which is 4.4.2.0) does not report any error and the resulting program runs fine. It should instead mirror the Roslyn compiler and fail during compilation.