Author: raja
Date: 2005-09-01 08:19:17 -0400 (Thu, 01 Sep 2005)
New Revision: 49263
Modified:
trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
Log:
* CustomAttributeBuilder.cs (get_umarshal): Don't cause a nullref
exception when passed a custom marshaller type that belongs to the
assembly being built. When user specifies MarshalType rather than
MarshalTypeRef, don't attempt to resolve the type.
Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog 2005-09-01
12:10:12 UTC (rev 49262)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog 2005-09-01
12:19:17 UTC (rev 49263)
@@ -1,3 +1,10 @@
+2005-09-01 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * CustomAttributeBuilder.cs (get_umarshal): Don't cause a nullref
+ exception when passed a custom marshaller type that belongs to the
+ assembly being built. When user specifies MarshalType rather than
+ MarshalTypeRef, don't attempt to resolve the type.
+
2005-08-31 Raja R Harinath <[EMAIL PROTECTED]>
* CustomAttributeBuilder.cs (get_umarshal): Fix typo. The name of
Modified:
trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
2005-09-01 12:10:12 UTC (rev 49262)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
2005-09-01 12:19:17 UTC (rev 49263)
@@ -219,6 +219,7 @@
bool hasSize = false;
int value;
int utype; /* the (stupid) ctor takes a short or an
enum ... */
+ string marshalTypeName = null;
Type marshalTypeRef = null;
string marshalCookie = String.Empty;
utype = (int)data [2];
@@ -261,12 +262,17 @@
sizeParamIndex = value;
hasSize = true;
break;
- case "MarshalTypeRef":
case "MarshalType":
len = decode_len (data, pos, out pos);
- marshalTypeRef = Type.GetType
(string_from_bytes (data, pos, len));
+ marshalTypeName = string_from_bytes
(data, pos, len);
pos += len;
break;
+ case "MarshalTypeRef":
+ len = decode_len (data, pos, out pos);
+ marshalTypeName = string_from_bytes
(data, pos, len);
+ marshalTypeRef = Type.GetType
(marshalTypeName);
+ pos += len;
+ break;
case "MarshalCookie":
len = decode_len (data, pos, out pos);
marshalCookie = string_from_bytes
(data, pos, len);
@@ -293,7 +299,7 @@
case UnmanagedType.ByValTStr:
return UnmanagedMarshal.DefineByValTStr
(sizeConst);
case UnmanagedType.CustomMarshaler:
- return UnmanagedMarshal.DefineCustom (
marshalTypeRef, marshalCookie, marshalTypeRef.ToString (), Guid.Empty);
+ return UnmanagedMarshal.DefineCustom
(marshalTypeRef, marshalCookie, marshalTypeName, Guid.Empty);
default:
return UnmanagedMarshal.DefineUnmanagedMarshal
((UnmanagedType)utype);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches