Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Default parameters were implemented in C# 4.0 (.NET 4.0), so then compiling with gmcs this testcase:
public static class MyClass
public static void TestWithOptionalParams (bool optional = false)
Should generate the following error, which C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe generated:
"Default parameter specifiers are not permitted"
The example of why this bug shouldn't be WONTFIXed is because of how this bug was discovered by a banshee developer: our build targets .NET 3.5, and we had already added some default-parameter code in banshee by mistake, making the Windows build fail (but having a misleading green Linux build).
gmcs is not language but profile specific. If you need to limit C# features use -langversion
>If you need to limit C# features use -langversion
Fair enough... but shouldn't gmcs default to this langversion in the script? (So you can still specify a higher version of C# if you are interested.)
gmcs is not C# 2.0 compiler it's compiler targeting .NET 2.0 runtime.
> gmcs is not C# 2.0 compiler it's compiler targeting .NET 2.0 runtime.
Right, and the .NET 2.0 runtime used to map to the 2.0 & 3.0 version of C#, not higher :)
I guess then that xbuild should be the one using -langversion 3 when dealing with a .NET2.0/.NET3.5 project...
Maybe but it's more project specific. I am not sure but I think VS does same when in VS2k12 you target 2.0 runtime.
>Maybe but it's more project specific. I am not sure but I think VS does same
>when in VS2k12 you target 2.0 runtime.
Apparently you can set this per project via "Project Properties"->"Build"->"Advanced"->"Language Version".
Would you accept a patch that made langversion default to 3 if the sdk is set to 3.5? (Converting the feature from opt-out to opt-in.) This way, you would still be able to compile C# 4.0 via using /langversion, and it would map more closely to what C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe does.
No, master gmcs is same as 4.5.1 csc targeting 2.0 runtime. If you for some reason you need to resting language version use -langversion, exactly as you would do in the latest VS