[Mono-devel-list] patch for TypeBuilder.CreateType() and mcs

Martin Baulig martin at ximian.com
Sun Mar 13 01:51:50 EST 2005


Hi,

I'd call it a bug if MCS or GMCS ever calls TypeBuilder.CreateType() on
an already created type.

Is there any situation where this is happening ?

Martin

On Fri, 2005-03-11 at 11:15 +0530, Raja R Harinath wrote:
> Atsushi Eno <atsushi at ximian.com> writes:
> 
> > Index: mcs/class.cs
> > ===================================================================
> > --- mcs/class.cs	(revision 41656)
> > +++ mcs/class.cs	(working copy)
> > @@ -2118,7 +2118,15 @@
> >  
> >  			try {
> >  				caching_flags |= Flags.CloseTypeCreated;
> > -				TypeBuilder.CreateType ();
> > +#if NET_2_0
> > +				if (!TypeBuilder.IsCreated ())
> > +					TypeBuilder.CreateType ();
> > +#else
> > +				try {
> > +					TypeBuilder.CreateType ();
> > +				} catch (InvalidOperationException) {
> > +				}
> > +#endif
> >  			} catch (TypeLoadException){
> >  				//
> >  				// This is fine, the code still created the type
> 
> The NET_2_0 define isn't meaningful in the current mcs code.  Does the 
> 
>   try ... catch
> 
> version above also work with the .NET 2.0 profile?  I suspect it does.
> If so, that's the code that should go into mcs.
> 
> For 'gmcs', we can use the NET_2_0 variant, again without the #if.
> 
> - Hari
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list