Bugzilla – Bug 318732
[PATCH] CLS + partial classes crash.
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by miguel@ximian.com 2005-08-12 19:47:22 MST ---- The following program crashes the compiler: [assembly:CLSCompliant(true)] namespace System { [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] internal sealed class MonoTODOAttribute : Attribute { string comment; public MonoTODOAttribute () { } } } namespace System.Web { public partial class HttpBrowserCapabilities { [MonoTODO] public Version A { get { throw new Exception (); } } } } ---- Additional Comments From atsushi@ximian.com 2005-08-29 15:27:27 MST ---- Created an attachment (id=168363) patch. I wonder if this is really a right way... ---- Additional Comments From rharinath@novell.com 2005-08-29 23:08:20 MST ---- Eno, 'ec' should not be null at that point. So, your patch just papers over the issue. We'll have to look higher up the backtrace to see who's passing down the bad 'ec'. ---- Additional Comments From atsushi@ximian.com 2005-08-30 01:17:03 MST ---- That's the exact worry I had. It's TypeContainer.DefineType() ---- if (Parts != null) { ec = null; foreach (ClassPart part in Parts) { part.TypeBuilder = TypeBuilder; part.ptype = ptype; part.ec = new EmitContext (part, Mono.CSharp.Location.Null, null, null, ModFlags); part.ec.ContainerType = TypeBuilder; } } else { ---- Where we don't set ec for this TypeContainer itself. (I tried to set a new EmitContext here but it crashed elsewhere.) ---- Additional Comments From rharinath@novell.com 2005-08-30 02:45:07 MST ---- That is on purpose: a PartialContainer should not have an EmitContext. ---- Additional Comments From rharinath@novell.com 2005-08-30 04:54:41 MST ---- Fixed in SVN r49109. ---- Additional Comments From rharinath@novell.com 2005-08-30 04:55:16 MST ---- . Imported an attachment (id=168363) Unknown operating system unknown. Setting to default OS "Other".