[Mono-devel-list] TypeBuilder and Exceptions
Marcus
mathpup at mylinuxisp.com
Fri Mar 5 22:17:35 EST 2004
I posted a bug report http://bugs.ximian.com/show_bug.cgi?id=55247 about some
inconsistencies in exceptions that .NET raises but Mono does not. However, I
also wanted to bring up the topic here.
During the time a Type is being constructed using a TypeBuilder instance, many
of the reflection operations (that would normally be permitted on a Type) are
not allowed by .NET. For example, if tb is a TypeBuilder under construction
(i.e. CreateType() has not yet been called), tb.GetConstructors(),
tb.GetMethods(), and many other methods throw exceptions under .NET. On the
other hand, Mono fails to throw exceptions for those methods.
Someone has noted this for the particular case of GetEvents in TypeBuilder.cs:
public override EventInfo[] GetEvents (BindingFlags bindingAttr) {
// FIXME: Under MS.NET, this throws a NotImplementedException
// But mcs calls this method. How can that be?
return new EventInfo [0];
I am not sure if mcs still uses GetEvents or if mcs uses any of the other
methods for which .NET throws an exception. However, if maximum compatibility
with .NET is desired, it seems that checking which reflection methods .NET
permits and matching that behavior on Mono, while keeping mcs working with
these changes, needs to be done.
More information about the Mono-devel-list
mailing list