[Mono-bugs] [Bug 598040] New: Compilation error: System.ArgumentException: Key duplication when adding: TResult Invoke(T) (When using MS_COMPATIBLE)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 20 04:55:17 EDT 2010


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

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


           Summary: Compilation error: System.ArgumentException: Key
                    duplication when adding: TResult Invoke(T) (When using
                    MS_COMPATIBLE)
    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: pruiz at netway.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1045 Safari/532.5

When compiling with gmcs.exe (compiled with MS_COMPATIBLE) the following code
causes the compiler error shown on subject:

----- p.cs -----
using System;
using System.Linq;
using System.Linq.Expressions;

namespace Test
{
        /*  public class Rate {
                        public int Id { get; protected set; }
          }*/

        public class OrderBySpecification
        {
                public OrderBySpecification(Expression<Func<object, object>>
predicate)
                {
                }
        }

        public class RateOrderById : OrderBySpecification
        {
                public RateOrderById()
                        : base(x => x)
                {
                }
        }
}
------------

Example output:

[root at QSMaster tmp]# mono ./gmcs.exe /target:library p.cs

Unhandled Exception: Mono.CSharp.InternalErrorException: p.cs(20,24):
Test.RateOrderById.RateOrderById() ---> System.ArgumentException: Key
duplication when adding: TResult Invoke(T)
  at System.Collections.Hashtable.PutImpl (System.Object key, System.Object
value, Boolean overwrite) [0x00000]
  at System.Collections.Hashtable.Add (System.Object key, System.Object value)
[0x00000]
  at Mono.CSharp.TypeManager.RegisterMethod (System.Reflection.MethodBase mb,
Mono.CSharp.AParametersCollection ip) [0x00000]
  at Mono.CSharp.Delegate.GetInvokeMethod (Mono.CSharp.CompilerContext ctx,
System.Type container_type, System.Type delegate_type) [0x00000]
  at Mono.CSharp.AnonymousMethodExpression.Compatible
(Mono.CSharp.ResolveContext ec, System.Type type) [0x00000]
  at Mono.CSharp.AnonymousMethodExpression.ImplicitStandardConversionExists
(Mono.CSharp.ResolveContext ec, System.Type delegate_type) [0x00000]
  at Mono.CSharp.Convert.ImplicitConversionExists (Mono.CSharp.ResolveContext
ec, Mono.CSharp.Expression expr, System.Type target_type) [0x00000]
  at Mono.CSharp.MethodGroupExpr.IsArgumentCompatible
(Mono.CSharp.ResolveContext ec, Modifier arg_mod, Mono.CSharp.Argument
argument, Modifier param_mod, System.Type parameter) [0x00000]
  at Mono.CSharp.MethodGroupExpr.IsApplicable (Mono.CSharp.ResolveContext ec,
Mono.CSharp.Arguments& arguments, Int32 arg_count,
System.Reflection.MethodBase& method, System.Boolean& params_expanded_form)
[0x00000]
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext
ec, Mono.CSharp.Arguments& Arguments, Boolean may_fail, Location loc) [0x00000]
  at Mono.CSharp.ConstructorInitializer.DoResolve (Mono.CSharp.ResolveContext
ec) [0x00000]
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec,
ResolveFlags flags) [0x00000]
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000]
  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext
ec) [0x00000]
  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.BlockContext ec)
[0x00000]
  at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000]
  at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent,
Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md)
[0x00000]
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer.EmitConstructors () [0x00000]
  at Mono.CSharp.TypeContainer.EmitType () [0x00000]
  at Mono.CSharp.RootContext.EmitCode () [0x00000]
  at Mono.CSharp.Driver.Compile () [0x00000]
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000]


Reproducible: Always

Steps to Reproduce:
1. Create a p.cs file like the one appearing on issue description
2. Try to compile with gmcs
3. See resulted exception
Actual Results:  
Compilation fails with Mono.CSharp.InternalErrorException.

Expected Results:  
Normal compilation.

Tested against trunk, fails too.

-- 
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