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

Raja R Harinath rharinath at novell.com
Fri Mar 11 00:45:17 EST 2005


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



More information about the Mono-devel-list mailing list