Bug 315802 (MONO63144) - [PATCH] mcs crashes when array initializer uses unknown constructor
Summary: [PATCH] mcs crashes when array initializer uses unknown constructor
Status: RESOLVED FIXED
Alias: MONO63144
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-16 15:41 UTC by Colin JN Breame
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
patch (1.08 KB, patch)
2004-08-29 21:24 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:50:19 UTC


---- Reported by colin@breame.com 2004-08-16 08:41:28 MST ----

mcs 1.0.1.

public class A {
    A[] test = {
        new A("test")
    };
}

$ mcs test.cs
test.cs(3) error CS1501: No overload for method `A' takes `1' arguments
test.cs(3) error CS1501: New invocation: Can not find a constructor in `A'
for this argument list

Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
in (unmanaged) (wrapper managed-to-native)
System.Reflection.Emit.ModuleBuilder:getToken
(System.Reflection.Emit.ModuleBuilder,object)
in <0x00004> (wrapper managed-to-native)
System.Reflection.Emit.ModuleBuilder:getToken
(System.Reflection.Emit.ModuleBuilder,object)
in <0x0000e> System.Reflection.Emit.ModuleBuilder:GetToken
(System.Reflection.MemberInfo)
in <0x00015> System.Reflection.Emit.ModuleBuilderTokenGenerator:GetToken
(System.Reflection.MemberInfo)
in <0x0002c> System.Reflection.Emit.ILGenerator:Emit
(System.Reflection.Emit.OpCode,System.Reflection.ConstructorInfo)
in <0x00273> Mono.CSharp.New:DoEmit (Mono.CSharp.EmitContext,bool)
in <0x00017> Mono.CSharp.New:Emit (Mono.CSharp.EmitContext)
in <0x00420> Mono.CSharp.ArrayCreation:EmitDynamicInitializers
(Mono.CSharp.EmitContext)
in <0x00157> Mono.CSharp.ArrayCreation:Emit (Mono.CSharp.EmitContext)
in <0x00135> Mono.CSharp.FieldExpr:EmitAssign
(Mono.CSharp.EmitContext,Mono.CSharp.Expression)
in <0x002aa> Mono.CSharp.Assign:Emit (Mono.CSharp.EmitContext,bool)
in <0x00016> Mono.CSharp.Assign:EmitStatement (Mono.CSharp.EmitContext)
in <0x001de> Mono.CSharp.TypeContainer:EmitFieldInitializers
(Mono.CSharp.EmitContext)
in <0x00388> Mono.CSharp.Constructor:Emit (Mono.CSharp.TypeContainer)
in <0x00427> Mono.CSharp.TypeContainer:Emit ()
in <0x00896> Mono.CSharp.RootContext:EmitCode ()
in <0x00c35> Mono.CSharp.Driver:MainDriver (string[])
in <0x00012> Mono.CSharp.Driver:Main (string[])



---- Additional Comments From bmaurer@users.sf.net 2004-08-29 14:24:40 MST ----

Created an attachment (id=166653)
patch




---- Additional Comments From bmaurer@users.sf.net 2004-08-29 14:25:42 MST ----

Simple patch -- make sure that ArrayCreation returns null from Resolve
if it has any invalid children



---- Additional Comments From bmaurer@users.sf.net 2004-08-29 14:26:24 MST ----

oops, ignore the check duplicates part. I forgot to revert that in my
tree.



---- Additional Comments From bmaurer@users.sf.net 2004-08-29 14:28:03 MST ----

*** https://bugzilla.novell.com/show_bug.cgi?id=MONO63143 has been marked as a duplicate of this bug. ***



---- Additional Comments From miguel@ximian.com 2004-09-07 16:04:05 MST ----

I applied Ben's patch.

Imported an attachment (id=166653)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Gentoo</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".