Bug 4801 - Mono 2.10.9 beta: compiler crash with named arguments
Summary: Mono 2.10.9 beta: compiler crash with named arguments
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-05-01 11:38 UTC by Brian Luczkiewicz
Modified: 2012-05-01 12:25 UTC (History)
1 user (show)

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:

Description Brian Luczkiewicz 2012-05-01 11:38:07 UTC
The following code crashes the compiler. It appears to be valid code and is accepted by microsoft's compiler.

If I rename one of the "Test" methods to something else, the bug disappears. Also, if I remove the names on the arguments in the call to Test, the bug disappears too.

$ cat t.cs

using System;

public class foo {
    public static T Test<T>(Func<string,T> p, string s1 = "", string s2 = "", string s3="") {
        return p(Test(s1: s1, s2: s2, s3: s3));

    public static string Test(string s1 = "", string s2 = "", string s3="") {
        return s1+s2+s3;

    public static void Main(string[] args) {

$ dmcs t.cs

t.cs(5,18): error CS0584: Internal compiler error: Object reference not set to an instance of an object
t.cs(5,16): error CS1594: Delegate `System.Func<string,T>' has some invalid arguments
t.cs(5,16): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
Compilation failed: 3 error(s), 0 warnings
Comment 1 Marek Safar 2012-05-01 12:25:02 UTC
Already fixed in Mono 2.11