Bug 4277 - C# Optional Parameter Not Supported (latest GIT checkout)?!
Summary: C# Optional Parameter Not Supported (latest GIT checkout)?!
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-04-05 18:55 UTC by thesaint1987
Modified: 2012-04-06 07:05 UTC (History)
1 user (show)

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

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 FIXED

Description thesaint1987 2012-04-05 18:55:33 UTC
I found a strange bug and I couldn't find any information except the link below. Just create a method with an optional parameter and the latest Git-Checkout version will raise an "Internal compiler error". Probably also other version will behave the same. The question is, am I missing some command line switches?! I would rather doubt that since it is a standard feature and should be enabled by default. If you want something bigger, just try to compile the corlib with the latest mono compiler. It should raise two "Internal compiler error" messages in the "System.Threading.Tasks.cs" file. I hope to see a fix for this, since optional parameters are quite important, at least they occur in larger codebases and cause trouble if not supported...


I found a sample solution and description which is not applicable to the current codebase (too many changes): http://stackoverflow.com/questions/4495108/mono-named-optional-parameters-compiler-bug
Comment 1 Marek Safar 2012-04-06 05:24:42 UTC
I cannot reproduce it with mono master or mono 2.11
Comment 2 thesaint1987 2012-04-06 05:32:55 UTC
Well, I am not using the Mono Build infrastructure, so maybe if I just create a new project from scratch for the Mono compiler, something get's screwed up?! But otherwise it is working just fine, only the optional parameter stuff fails. I will test it with the real Mono build system later, when I can find some time...
Comment 3 Marek Safar 2012-04-06 05:39:36 UTC
I am not sure what you mean by no using mono build infrastructure. I also tested opening mcs.csproj in VS and compiling on .net and that works as well.
Comment 4 thesaint1987 2012-04-06 07:01:51 UTC
I mean I just created a new mcs project from scratch and just added all the required files via reference in Visual Studio and copied the command preprocessor definitions from the original mono project ("NET_4_0;FULL_AST;..." & stuff). That's it. And when I do that, the resulting mono compiler is not able to deal with default parameters. But as I said, I will try it out for you later with the original mono build system and projects, and maybe it works (if it does for you it also should for me)...
Comment 5 thesaint1987 2012-04-06 07:05:07 UTC
Just really can't think of a reason why doing what I did will break it. That's why I am asking. Especially, since everything else works just fine. So I would rather guess it has something to do with configuration, some settings I didn't do in my private project that are done when using the build system.