[Mono-bugs] [Bug 629390] New: Gmcs crash on calling extension method for System.Drawing.Color

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Aug 8 09:03:06 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=629390

http://bugzilla.novell.com/show_bug.cgi?id=629390#c0


           Summary: Gmcs crash on calling extension method for
                    System.Drawing.Color
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: carl.adahl at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4
(KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

All code needed:


using System;
using System.Drawing;

namespace Repro2
{

    static class ExtensionMethods
    {
        public static Color Transparent(this Color c)
        {
            return Color.FromArgb(0,c);
        }
    }

    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Color: " + Color.Black.Transparent());
//            Console.WriteLine ("Color: " + Color.Transparent());
        }
    }
}


Reproducible: Always

Steps to Reproduce:
Compile the code.

Actual Results:  
Compile the code.

1) An error message that doesn't make sense to me. Shouldn't the extension
method work as used?
2) Compiler crash following that.

/usr/bin/gmcs /noconfig
"/out:/home/carl/Projects/Repro2/Repro2/bin/Debug/Repro2.exe"
"/r:/usr/lib/mono/2.0/System.dll" "/r:/usr/lib/mono/2.0/System.Core.dll"
"/r:/usr/lib/mono/2.0/System.Drawing.dll" /nologo /warn:4 /debug:+ /debug:full
/optimize- /codepage:utf8 /platform:x86 "/define:DEBUG"  /t:exe
"/home/carl/Projects/Repro2/Repro2/Main.cs"
"/home/carl/Projects/Repro2/Repro2/AssemblyInfo.cs" 
Internal compiler error at /home/carl/Projects/Repro2/Repro2/Main.cs(17,36)::
exception caught while emitting MethodBuilder [MainClass::Main]

/home/carl/Projects/Repro2/Repro2/Main.cs(19,68): error CS0176: Static member
`System.Drawing.Color.Transparent' cannot be accessed with an instance
reference, qualify it with a type name instead

Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
  at Mono.CSharp.Argument..ctor (Mono.CSharp.Expression expr) [0x00000] in
<filename unknown>:0 
  at Mono.CSharp.ExtensionMethodGroupExpr.OverloadResolve
(Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Boolean
may_fail, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000]
in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec,
ResolveFlags flags) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000]
in <filename unknown>:0 
  at Mono.CSharp.Binary.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in
<filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec,
ResolveFlags flags) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000]
in <filename unknown>:0 
  at Mono.CSharp.Argument.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in
<filename unknown>:0 
  at Mono.CSharp.Arguments.Resolve (Mono.CSharp.ResolveContext ec,
System.Boolean& dynamic) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000]
in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec,
ResolveFlags flags) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000]
in <filename unknown>:0 
  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext
ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.BlockContext ec)
[0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in
<filename unknown>:0 
  at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent,
Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md)
[0x00000] in <filename unknown>:0 


Build complete -- 1 error, 0 warnings


Expected Results:  
0 errors?

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list