[Mono-bugs] [Bug 76371][Nor] Changed - NullReferenceException compiling NDoc

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Oct 14 17:49:35 EDT 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by miguel at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76371

--- shadow/76371	2005-10-14 17:21:08.000000000 -0400
+++ shadow/76371.tmp.24881	2005-10-14 17:49:35.000000000 -0400
@@ -10,13 +10,13 @@
 Component: C#
 AssignedTo: rharinath at novell.com                            
 ReportedBy: gert.driesen at pandora.be               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
-Cc: 
+Cc: marek.safar at seznam.cz,martin at ximian.com,rharinath at novell.com
 Summary: NullReferenceException compiling NDoc
 
 MCS (svn head) throws a NullReferenceException when compiling NDoc:
 
 Unhandled Exception: System.NullReferenceException: Object reference not
 set to an instance of an object
@@ -60,6 +60,66 @@
 class X {
 	static void Main () {}
 }
 
 The problem is that the attribute [TypeConverter()] is referencing the
 nested PathItemBase.TypeConverter.
+
+------- Additional Comments From miguel at ximian.com  2005-10-14 17:49 -------
+Ok, the problem is that the GetObsoleteAttribute call in
+class.cs:1248 (TypeContainer.DefineType) is triggering a definition of
+all the attributes, which "queues" the nested class for definition
+ahead of the container type.
+
+I moved the checking of the attributes after the order for a class has
+been registered and this seems to help, but in general the type
+registration framework should probably take containing types into
+account, something that it does not do today.
+
+I am hoping that we can get some feedback from the compiler developers
+on this.  CCing them.   Here is a patch that seems to fix this:
+
+Index: class.cs
+===================================================================
+--- class.cs    (revision 51728)
++++ class.cs    (working copy)
+@@ -1279,14 +1279,6 @@
+                                TypeBuilder.SetParent (ptype);
+                        }
+
+-                       // Attribute is undefined at the begining of
+corlib compilation
+-                       if (TypeManager.obsolete_attribute_type != null) {
+-                              
+TypeResolveEmitContext.TestObsoleteMethodUsage = GetObsoleteAttribute
+() == null;
+-                               if (ptype != null &&
+TypeResolveEmitContext.TestObsoleteMethodUsage) {
+-                                       CheckObsoleteType (base_type);
+-                               }
+-                       }
+-
+                        // add interfaces that were not added at type
+creation
+                        if (iface_exprs != null) {
+                                // FIXME: I think this should be
+...ExpandInterfaces (Parent.EmitContext, ...).
+@@ -1307,6 +1299,14 @@
+                        if (!(this is Iterator))
+                                RootContext.RegisterOrder (this);
+
++                       // Attribute is undefined at the begining of
+corlib compilation
++                       if (TypeManager.obsolete_attribute_type != null) {
++                              
+TypeResolveEmitContext.TestObsoleteMethodUsage = GetObsoleteAttribute
+() == null;
++                               if (ptype != null &&
+TypeResolveEmitContext.TestObsoleteMethodUsage) {
++                                       CheckObsoleteType (base_type);
++                               }
++                       }
++
+                        if (!DefineNestedTypes ()) {
+                                error = true;
+                                return null;
+


More information about the mono-bugs mailing list