Skip to content

Commit 6dd451f

Browse files
morganbrstephentoub
authored andcommitted
Scale back [Serializable] CoreFX types (dotnet#19742)
* Remove SerializableAttribute from many CoreFX types that will not be serializable. * Removes serialization tests for types that are no longer serializable and fixes serializing a couple of types. Includes marking some internal serializable types as public so that they'll be reflectible with .NET Native. * Remove unneeded pragmas * Update based on review comments
1 parent b0900bb commit 6dd451f

File tree

460 files changed

+42
-858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+42
-858
lines changed

CodeAnalysis.ruleset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Rule Id="CA2229" Action="Error" /> <!-- Serializable type doesn't have a serialization constructor -->
2020
<Rule Id="CA2235" Action="None" /> <!-- Serializable type has non serializable field -->
2121
<Rule Id="CA2231" Action="None" /> <!-- Overload operator equals when overriding ValueType.Equals -->
22-
<Rule Id="CA2237" Action="Error" /> <!-- Add [Serializable] to types that implement ISerializable -->
22+
<Rule Id="CA2237" Action="None" /> <!-- Add [Serializable] to types that implement ISerializable -->
2323

2424
<Rule Id="CA2200" Action="None"/> <!-- Rethrowing caught exception changes stack information -->
2525

src/Common/src/System/CodeDom/CodeObject.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace System.CodeDom
1111
namespace System.Runtime.Serialization
1212
#endif
1313
{
14-
[Serializable]
1514
#if !FEATURE_SERIALIZATION
1615
public class CodeObject
1716
#else

src/Common/src/System/CodeDom/CodeTypeReference.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ internal enum CodeTypeReferenceOptions
2323
GenericTypeParameter = 0x00000002
2424
}
2525

26-
[Serializable]
2726
#if !FEATURE_SERIALIZATION
2827
public class CodeTypeReference : CodeObject
2928
#else

src/Common/src/System/CodeDom/CodeTypeReferenceCollection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace System.CodeDom
1010
namespace System.Runtime.Serialization
1111
#endif
1212
{
13-
[Serializable]
1413
#if !FEATURE_SERIALIZATION
1514
public class CodeTypeReferenceCollection : CollectionBase
1615
#else

src/Common/src/System/Collections/CompatibleComparer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace System.Collections
88
{
9-
[Serializable]
109
internal sealed class CompatibleComparer : IEqualityComparer
1110
{
1211
private readonly IHashCodeProvider _hcp;

src/Common/src/System/Data/Common/NameValuePair.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace System.Data.Common
99
{
10-
[Serializable]
1110
internal sealed class NameValuePair
1211
{
1312
readonly private string _name;

src/Common/src/System/Net/NetworkInformation/NetworkInformationException.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace System.Net.NetworkInformation
1414
/// Provides NetworkInformation exceptions to the application.
1515
/// </para>
1616
/// </devdoc>
17-
[Serializable]
1817
public class NetworkInformationException : Win32Exception
1918
{
2019
/// <devdoc>

src/Common/src/System/Text/DBCSDecoder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace System.Text
1010
{
11-
[Serializable]
1211
internal sealed class DecoderDBCS : Decoder
1312
{
1413
private readonly Encoding _encoding;

src/Common/src/System/Text/OSEncoder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace System.Text
1010
{
11-
[Serializable]
1211
internal sealed class OSEncoder : Encoder
1312
{
1413
private char _charLeftOver;

src/Common/src/System/Text/OSEncoding.Windows.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace System.Text
1111
{
12-
[Serializable]
1312
internal sealed class OSEncoding : Encoding
1413
{
1514
private readonly int _codePage;

0 commit comments

Comments
 (0)