Bug 318732 (MONO75802) - [PATCH] CLS + partial classes crash.
Summary: [PATCH] CLS + partial classes crash.
Status: RESOLVED FIXED
Alias: MONO75802
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Raja R Harinath
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-13 02:47 UTC by Miguel de Icaza
Modified: 2007-09-15 21:24 UTC (History)
1 user (show)

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


Attachments
patch. I wonder if this is really a right way... (425 bytes, patch)
2005-08-29 22:27 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 19:27:27 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".