[Mono-list] patch WeakReference: GetObjectData & ctr for ISerializable implementation
Cesar Octavio López Nataren
cesar@ciencias.unam.mx
Wed, 14 Aug 2002 00:14:06 -0500
This is a MIME-formatted message. If you see this text it means that your
mail software cannot handle MIME-formatted messages.
--=_0_2690_1029302046
Content-Type: text/plain; format=flowed; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Hello mono:: team!!
Here is another ;) small patch.
(feedback welcomed)
Best regards.
cesar
--=_0_2690_1029302046
Content-Disposition: attachment; filename="WeakReference.diff"
Content-Type: text/plain; charset="iso-8859-1"; name="WeakReference.diff"
Content-Transfer-Encoding: 7bit
Index: WeakReference.cs
===================================================================
RCS file: /mono/mcs/class/corlib/System/WeakReference.cs,v
retrieving revision 1.1
diff -u -r1.1 WeakReference.cs
--- WeakReference.cs 26 Feb 2002 20:30:39 -0000 1.1
+++ WeakReference.cs 14 Aug 2002 05:09:01 -0000
@@ -53,10 +53,8 @@
if (info == null)
throw new ArgumentNullException ("info");
- this.isLongReference = info.GetBoolean("IsLongReference");
- //TODO: How to load the exact type?
- //Does that matter? No idea :(
- Object target = info.GetValue("TargetObject",typeof(System.Object));
+ this.isLongReference = info.GetBoolean ("TrackResurrection");
+ Object target = info.GetValue ("TrackedObject", typeof (System.Object));
AllocateHandle(target);
}
@@ -99,20 +97,17 @@
gcHandle.Free();
}
- //TODO
- public virtual void GetObjectData(SerializationInfo info,StreamingContext context)
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
- info.AddValue("IsLongReference",this.isLongReference);
- try
- {
- info.AddValue("TargetObject",Target);
- }
- catch(Exception)
- {
- info.AddValue("TargetObject",null);
+ info.AddValue ("TrackResurrection", TrackResurrection);
+
+ try {
+ info.AddValue ("TrackedObject", Target);
+ } catch(Exception) {
+ info.AddValue("TrackedObject",null);
}
}
}
--=_0_2690_1029302046
Content-Disposition: attachment; filename="weakReference_serialization2.xml"
Content-Type: text/plain; charset="iso-8859-1"; name="weakReference_serialization2.xml"
Content-Transfer-Encoding: quoted-printable
<SOAP-ENV:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance=
" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC=3D"http:/=
/schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV=3D"http://schemas.xml=
soap.org/soap/envelope/" xmlns:clr=3D"http://schemas.microsoft.com/soap/e=
ncoding/clr/1.0" SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soa=
p/encoding/">=0D
<SOAP-ENV:Body>=0D
<a1:WeakReference id=3D"ref-1" xmlns:a1=3D"http://schemas.microsoft.com/c=
lr/ns/System">=0D
<TrackedObject id=3D"ref-2" xsi:type=3D"SOAP-ENC:string">hey hey hey</Tra=
ckedObject>=0D
<TrackResurrection>false</TrackResurrection>=0D
</a1:WeakReference>=0D
</SOAP-ENV:Body>=0D
</SOAP-ENV:Envelope>=0D
--=_0_2690_1029302046--