Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 292d4ea

Browse files
committed
Expose serialization primitives from System.Private.Corelib
- Update the model.xml file to expose the serialization primitives from the runtime, e.g. [Serializable], [NonSerialized], ISerializable, etc. - Tweak how FEATURE_SERIALIZATION is used on some types. ISerializable and IDeserializationCallback are not ifdef'd based on FEATURE_SERIALIZATION, but their members are, which means there are some types which are implementing the interface but have the implementation of the interface's method ifdef'd. This commit removes the ifdef'ing of the methods on the interface, and then ifdef's the implementation of the interface on the offending types.
1 parent 481c181 commit 292d4ea

29 files changed

+246
-51
lines changed

src/mscorlib/model.xml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6352,6 +6352,9 @@
63526352
<Member Name="IsStateAvailable" />
63536353
<Member Name="EnsureState" />
63546354
</Type>
6355+
<Type Name="System.SerializableAttribute">
6356+
<Member Name="#ctor" />
6357+
</Type>
63556358
<Type Name="System.Single">
63566359
<Member MemberType="Field" Name="Epsilon" />
63576360
<Member MemberType="Field" Name="MaxValue" />
@@ -9526,11 +9529,98 @@
95269529
<Type Name="System.Runtime.Serialization.FormatterServices">
95279530
<Member Name="GetUninitializedObject(System.Type)" />
95289531
</Type>
9532+
<Type Name="System.Runtime.Serialization.OptionalFieldAttribute">
9533+
<Member Name="#ctor" />
9534+
<Member MemberType="Property" Name="VersionAdded" />
9535+
</Type>
9536+
<Type Name="System.Runtime.Serialization.SerializationEntry">
9537+
<Member MemberType="Property" Name="Value" />
9538+
<Member MemberType="Property" Name="Name" />
9539+
<Member MemberType="Property" Name="ObjectType" />
9540+
</Type>
95299541
<Type Name="System.Runtime.Serialization.SerializationException">
95309542
<Member Name="#ctor" />
95319543
<Member Name="#ctor(System.String)" />
95329544
<Member Name="#ctor(System.String,System.Exception)" />
95339545
</Type>
9546+
<Type Name="System.Runtime.Serialization.SerializationInfo">
9547+
<Member Name="#ctor(System.Type,System.Runtime.Serialization.IFormatterConverter)" />
9548+
<Member Name="#ctor(System.Type,System.Runtime.Serialization.IFormatterConverter,System.Boolean)" />
9549+
<Member Name="SetType(System.Type)" />
9550+
<Member Name="GetEnumerator" />
9551+
<Member Name="AddValue(System.String,System.Object,System.Type)" />
9552+
<Member Name="AddValue(System.String,System.Object)" />
9553+
<Member Name="AddValue(System.String,System.Boolean)" />
9554+
<Member Name="AddValue(System.String,System.Char)" />
9555+
<Member Name="AddValue(System.String,System.SByte)" />
9556+
<Member Name="AddValue(System.String,System.Byte)" />
9557+
<Member Name="AddValue(System.String,System.Int16)" />
9558+
<Member Name="AddValue(System.String,System.UInt16)" />
9559+
<Member Name="AddValue(System.String,System.Int32)" />
9560+
<Member Name="AddValue(System.String,System.UInt32)" />
9561+
<Member Name="AddValue(System.String,System.Int64)" />
9562+
<Member Name="AddValue(System.String,System.UInt64)" />
9563+
<Member Name="AddValue(System.String,System.Single)" />
9564+
<Member Name="AddValue(System.String,System.Double)" />
9565+
<Member Name="AddValue(System.String,System.Decimal)" />
9566+
<Member Name="AddValue(System.String,System.DateTime)" />
9567+
<Member Name="GetValue(System.String,System.Type)" />
9568+
<Member Name="GetBoolean(System.String)" />
9569+
<Member Name="GetChar(System.String)" />
9570+
<Member Name="GetSByte(System.String)" />
9571+
<Member Name="GetByte(System.String)" />
9572+
<Member Name="GetInt16(System.String)" />
9573+
<Member Name="GetUInt16(System.String)" />
9574+
<Member Name="GetInt32(System.String)" />
9575+
<Member Name="GetUInt32(System.String)" />
9576+
<Member Name="GetInt64(System.String)" />
9577+
<Member Name="GetUInt64(System.String)" />
9578+
<Member Name="GetSingle(System.String)" />
9579+
<Member Name="GetDouble(System.String)" />
9580+
<Member Name="GetDecimal(System.String)" />
9581+
<Member Name="GetDateTime(System.String)" />
9582+
<Member Name="GetString(System.String)" />
9583+
<Member MemberType="Property" Name="FullTypeName" />
9584+
<Member MemberType="Property" Name="AssemblyName" />
9585+
<Member MemberType="Property" Name="MemberCount" />
9586+
<Member MemberType="Property" Name="ObjectType" />
9587+
<Member MemberType="Property" Name="IsFullTypeNameSetExplicit" />
9588+
<Member MemberType="Property" Name="IsAssemblyNameSetExplicit" />
9589+
</Type>
9590+
<Type Name="System.Runtime.Serialization.SerializationInfoEnumerator">
9591+
<Member Name="MoveNext" />
9592+
<Member Name="Reset" />
9593+
<Member Name="System.Collections.IEnumerator.get_Current" />
9594+
<Member MemberType="Property" Name="Current" />
9595+
<Member MemberType="Property" Name="Name" />
9596+
<Member MemberType="Property" Name="Value" />
9597+
<Member MemberType="Property" Name="ObjectType" />
9598+
</Type>
9599+
<Type Name="System.Runtime.Serialization.ISerializable">
9600+
<Member Name="GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
9601+
</Type>
9602+
<Type Name="System.Runtime.Serialization.IFormatterConverter">
9603+
<Member Name="Convert(System.Object,System.Type)" />
9604+
<Member Name="Convert(System.Object,System.TypeCode)" />
9605+
<Member Name="ToBoolean(System.Object)" />
9606+
<Member Name="ToChar(System.Object)" />
9607+
<Member Name="ToSByte(System.Object)" />
9608+
<Member Name="ToByte(System.Object)" />
9609+
<Member Name="ToInt16(System.Object)" />
9610+
<Member Name="ToUInt16(System.Object)" />
9611+
<Member Name="ToInt32(System.Object)" />
9612+
<Member Name="ToUInt32(System.Object)" />
9613+
<Member Name="ToInt64(System.Object)" />
9614+
<Member Name="ToUInt64(System.Object)" />
9615+
<Member Name="ToSingle(System.Object)" />
9616+
<Member Name="ToDouble(System.Object)" />
9617+
<Member Name="ToDecimal(System.Object)" />
9618+
<Member Name="ToDateTime(System.Object)" />
9619+
<Member Name="ToString(System.Object)" />
9620+
</Type>
9621+
<Type Name="System.Runtime.Serialization.IDeserializationCallback">
9622+
<Member Name="OnDeserialization(System.Object)" />
9623+
</Type>
95349624
<Type Status="ApiRoot" Name="System.Runtime.Serialization.OnSerializingAttribute">
95359625
<Member Name="#ctor" />
95369626
</Type>

src/mscorlib/src/System/DateTime.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ namespace System {
5555
#if FEATURE_SERIALIZATION
5656
[Serializable]
5757
#endif
58-
public struct DateTime : IComparable, IFormattable, IConvertible, ISerializable, IComparable<DateTime>,IEquatable<DateTime> {
58+
public struct DateTime : IComparable, IFormattable, IConvertible, IComparable<DateTime>, IEquatable<DateTime>
59+
#if FEATURE_SERIALIZATION
60+
, ISerializable
61+
#endif
62+
{
5963

6064
// Number of 100ns ticks per time unit
6165
private const long TicksPerMillisecond = 10000;

src/mscorlib/src/System/DateTimeOffset.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ namespace System {
3636
#if FEATURE_SERIALIZATION
3737
[Serializable]
3838
#endif
39-
public struct DateTimeOffset : IComparable, IFormattable, ISerializable, IDeserializationCallback,
40-
IComparable<DateTimeOffset>, IEquatable<DateTimeOffset> {
41-
39+
public struct DateTimeOffset : IComparable, IFormattable,
40+
IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>
41+
#if FEATURE_SERIALIZATION
42+
, ISerializable, IDeserializationCallback
43+
#endif
44+
{
4245
// Constants
4346
internal const Int64 MaxOffset = TimeSpan.TicksPerHour * 14;
4447
internal const Int64 MinOffset = -MaxOffset;

src/mscorlib/src/System/Decimal.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ namespace System {
6161
#endif
6262
[System.Runtime.InteropServices.ComVisible(true)]
6363
[System.Runtime.Versioning.NonVersionable] // This only applies to field layout
64-
public struct Decimal : IFormattable, IComparable, IConvertible, IDeserializationCallback
65-
, IComparable<Decimal>, IEquatable<Decimal> {
64+
public struct Decimal : IFormattable, IComparable, IConvertible, IComparable<Decimal>, IEquatable<Decimal>
65+
#if FEATURE_SERIALIZATION
66+
, IDeserializationCallback
67+
#endif
68+
{
6669

6770
// Sign mask for the flags field. A value of zero in this bit indicates a
6871
// positive Decimal value, and a value of one in this bit indicates a

src/mscorlib/src/System/Globalization/TextInfo.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ namespace System.Globalization {
3131
[Serializable]
3232
#endif
3333
[System.Runtime.InteropServices.ComVisible(true)]
34-
public class TextInfo : ICloneable, IDeserializationCallback
34+
public class TextInfo : ICloneable
35+
#if FEATURE_SERIALIZATION
36+
, IDeserializationCallback
37+
#endif
3538
{
3639
//--------------------------------------------------------------------//
3740
// Internal Information //

src/mscorlib/src/System/IO/DriveInfo.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public enum DriveType
4444
[Serializable]
4545
#endif
4646
[ComVisible(true)]
47-
public sealed class DriveInfo : ISerializable
47+
public sealed class DriveInfo
48+
#if FEATURE_SERIALIZATION
49+
, ISerializable
50+
#endif
4851
{
4952
private String _name;
5053

src/mscorlib/src/System/IntPtr.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ namespace System {
2626
[Serializable]
2727
#endif
2828
[System.Runtime.InteropServices.ComVisible(true)]
29-
public struct IntPtr : ISerializable
29+
public struct IntPtr
30+
#if FEATURE_SERIALIZATION
31+
: ISerializable
32+
#endif
3033
{
3134
[SecurityCritical]
3235
unsafe private void* m_value; // The compiler treats void* closest to uint hence explicit casts are required to preserve int behavior

src/mscorlib/src/System/Reflection/AssemblyName.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ namespace System.Reflection {
3131
[ClassInterface(ClassInterfaceType.None)]
3232
[ComDefaultInterface(typeof(_AssemblyName))]
3333
[System.Runtime.InteropServices.ComVisible(true)]
34-
public sealed class AssemblyName : _AssemblyName, ICloneable, ISerializable, IDeserializationCallback
34+
public sealed class AssemblyName : _AssemblyName, ICloneable
35+
#if FEATURE_SERIALIZATION
36+
, ISerializable, IDeserializationCallback
37+
#endif
3538
{
3639
//
3740
// READ ME

src/mscorlib/src/System/Reflection/Missing.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ namespace System.Reflection
1717
[Serializable]
1818
#endif
1919
[System.Runtime.InteropServices.ComVisible(true)]
20-
public sealed class Missing: ISerializable
20+
public sealed class Missing
21+
#if FEATURE_SERIALIZATION
22+
: ISerializable
23+
#endif
2124
{
2225
public static readonly Missing Value = new Missing();
2326

src/mscorlib/src/System/Reflection/Pointer.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ namespace System.Reflection {
2222
[Serializable]
2323
#endif
2424
[System.Runtime.InteropServices.ComVisible(true)]
25-
public sealed class Pointer: ISerializable {
26-
[SecurityCritical]
25+
public sealed class Pointer
26+
#if FEATURE_SERIALIZATION
27+
, ISerializable
28+
#endif
29+
{
30+
[SecurityCritical]
2731
unsafe private void* _ptr;
2832
private RuntimeType _ptrType;
2933

0 commit comments

Comments
 (0)