diff --git a/CodeAnalysis.ruleset b/CodeAnalysis.ruleset
index 2bf447f3f6..785a687fc1 100644
--- a/CodeAnalysis.ruleset
+++ b/CodeAnalysis.ruleset
@@ -19,7 +19,7 @@
-
+
diff --git a/src/Common/src/System/CodeDom/CodeObject.cs b/src/Common/src/System/CodeDom/CodeObject.cs
index 841955ce9b..64de79a8e2 100644
--- a/src/Common/src/System/CodeDom/CodeObject.cs
+++ b/src/Common/src/System/CodeDom/CodeObject.cs
@@ -11,6 +11,7 @@ namespace System.CodeDom
namespace System.Runtime.Serialization
#endif
{
+ [Serializable]
#if !FEATURE_SERIALIZATION
public class CodeObject
#else
diff --git a/src/Common/src/System/CodeDom/CodeTypeReference.cs b/src/Common/src/System/CodeDom/CodeTypeReference.cs
index 12b6173553..1488f70410 100644
--- a/src/Common/src/System/CodeDom/CodeTypeReference.cs
+++ b/src/Common/src/System/CodeDom/CodeTypeReference.cs
@@ -23,6 +23,7 @@ namespace System.Runtime.Serialization
GenericTypeParameter = 0x00000002
}
+ [Serializable]
#if !FEATURE_SERIALIZATION
public class CodeTypeReference : CodeObject
#else
diff --git a/src/Common/src/System/CodeDom/CodeTypeReferenceCollection.cs b/src/Common/src/System/CodeDom/CodeTypeReferenceCollection.cs
index 1b550702c2..7616d2d21a 100644
--- a/src/Common/src/System/CodeDom/CodeTypeReferenceCollection.cs
+++ b/src/Common/src/System/CodeDom/CodeTypeReferenceCollection.cs
@@ -10,6 +10,7 @@ namespace System.CodeDom
namespace System.Runtime.Serialization
#endif
{
+ [Serializable]
#if !FEATURE_SERIALIZATION
public class CodeTypeReferenceCollection : CollectionBase
#else
diff --git a/src/Common/src/System/Collections/CompatibleComparer.cs b/src/Common/src/System/Collections/CompatibleComparer.cs
index 8cd018a35a..ea1cebceed 100644
--- a/src/Common/src/System/Collections/CompatibleComparer.cs
+++ b/src/Common/src/System/Collections/CompatibleComparer.cs
@@ -6,6 +6,7 @@
namespace System.Collections
{
+ [Serializable]
internal sealed class CompatibleComparer : IEqualityComparer
{
private readonly IHashCodeProvider _hcp;
diff --git a/src/Common/src/System/Data/Common/NameValuePair.cs b/src/Common/src/System/Data/Common/NameValuePair.cs
index 27668b752c..f0b3a99b4f 100644
--- a/src/Common/src/System/Data/Common/NameValuePair.cs
+++ b/src/Common/src/System/Data/Common/NameValuePair.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.Data.Common
{
+ [Serializable]
internal sealed class NameValuePair
{
readonly private string _name;
diff --git a/src/Common/src/System/Net/NetworkInformation/NetworkInformationException.cs b/src/Common/src/System/Net/NetworkInformation/NetworkInformationException.cs
index 9ca96f67ef..aaa5ac4c1e 100644
--- a/src/Common/src/System/Net/NetworkInformation/NetworkInformationException.cs
+++ b/src/Common/src/System/Net/NetworkInformation/NetworkInformationException.cs
@@ -14,6 +14,7 @@ namespace System.Net.NetworkInformation
/// Provides NetworkInformation exceptions to the application.
///
///
+ [Serializable]
public class NetworkInformationException : Win32Exception
{
///
diff --git a/src/Common/src/System/Text/DBCSDecoder.cs b/src/Common/src/System/Text/DBCSDecoder.cs
index 7a6c89ce96..57488ebe6d 100644
--- a/src/Common/src/System/Text/DBCSDecoder.cs
+++ b/src/Common/src/System/Text/DBCSDecoder.cs
@@ -8,6 +8,7 @@ using System.Diagnostics;
namespace System.Text
{
+ [Serializable]
internal sealed class DecoderDBCS : Decoder
{
private readonly Encoding _encoding;
diff --git a/src/Common/src/System/Text/OSEncoder.cs b/src/Common/src/System/Text/OSEncoder.cs
index a42d48145d..2f02a00c65 100644
--- a/src/Common/src/System/Text/OSEncoder.cs
+++ b/src/Common/src/System/Text/OSEncoder.cs
@@ -8,6 +8,7 @@ using System.Diagnostics;
namespace System.Text
{
+ [Serializable]
internal sealed class OSEncoder : Encoder
{
private char _charLeftOver;
diff --git a/src/Common/src/System/Text/OSEncoding.Windows.cs b/src/Common/src/System/Text/OSEncoding.Windows.cs
index 835ba99190..47397037a4 100644
--- a/src/Common/src/System/Text/OSEncoding.Windows.cs
+++ b/src/Common/src/System/Text/OSEncoding.Windows.cs
@@ -9,6 +9,7 @@ using System.Diagnostics.Contracts;
namespace System.Text
{
+ [Serializable]
internal sealed class OSEncoding : Encoding
{
private readonly int _codePage;
diff --git a/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs b/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs
index 55545aab90..e435ab1da0 100644
--- a/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs
+++ b/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs
@@ -15,13 +15,6 @@ namespace System.Collections.Tests
public void IGenericSharedAPI_SerializeDeserialize(int count)
{
IEnumerable expected = GenericIEnumerableFactory(count);
-
- // Not all IEnumerables are intended to be Serializable
- if (!expected.GetType().IsSerializable)
- {
- return;
- }
-
IEnumerable actual = BinaryFormatterHelpers.Clone(expected);
if (Order == EnumerableOrder.Sequential)
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderException.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderException.cs
index 4a886ed75e..e0bca6cefa 100644
--- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderException.cs
+++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderException.cs
@@ -12,6 +12,7 @@ namespace Microsoft.CSharp.RuntimeBinder
/// represents a failure to bind in the sense of a usual compiler error, whereas
/// represents a malfunctioning of the runtime binder itself.
///
+ [Serializable]
public class RuntimeBinderException : Exception
{
///
diff --git a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderInternalCompilerException.cs b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderInternalCompilerException.cs
index a08e045aaa..3bfe8a2b9b 100644
--- a/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderInternalCompilerException.cs
+++ b/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderInternalCompilerException.cs
@@ -12,6 +12,7 @@ namespace Microsoft.CSharp.RuntimeBinder
/// represents a failure to bind in the sense of a usual compiler error, whereas
/// represents a malfunctioning of the runtime binder itself.
///
+ [Serializable]
public class RuntimeBinderInternalCompilerException : Exception
{
///
diff --git a/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs b/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs
index 90b9710191..9c0253abd0 100644
--- a/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs
+++ b/src/Microsoft.CSharp/tests/RuntimeBinderExceptionTests.cs
@@ -20,6 +20,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests
Assert.Empty(rbe.Data);
Assert.True((rbe.HResult & 0xFFFF0000) == 0x80130000); // Error from .NET
Assert.Contains(rbe.GetType().FullName, rbe.Message); // Localized, but should contain type name.
+ BinaryFormatterHelpers.AssertRoundtrips(rbe);
}
[Fact]
@@ -33,6 +34,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests
Assert.Same(message, rbe.Message);
rbe = new RuntimeBinderException(null);
Assert.Equal(new RuntimeBinderException().Message, rbe.Message);
+ BinaryFormatterHelpers.AssertRoundtrips(rbe);
}
@@ -43,6 +45,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests
Exception inner = new Exception("This is a test exception");
RuntimeBinderException rbe = new RuntimeBinderException(message, inner);
Assert.Same(inner, rbe.InnerException);
+ BinaryFormatterHelpers.AssertRoundtrips(rbe);
}
}
}
diff --git a/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs b/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs
index e21bb0a6f6..a35b128cb4 100644
--- a/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs
+++ b/src/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs
@@ -18,6 +18,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests
Assert.Empty(rbe.Data);
Assert.True((rbe.HResult & 0xFFFF0000) == 0x80130000); // Error from .NET
Assert.Contains(rbe.GetType().FullName, rbe.Message); // Localized, but should contain type name.
+ BinaryFormatterHelpers.AssertRoundtrips(rbe);
}
[Fact]
@@ -31,6 +32,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests
Assert.Same(message, rbe.Message);
rbe = new RuntimeBinderInternalCompilerException(null);
Assert.Equal(new RuntimeBinderInternalCompilerException().Message, rbe.Message);
+ BinaryFormatterHelpers.AssertRoundtrips(rbe);
}
@@ -41,6 +43,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests
Exception inner = new Exception("This is a test exception");
RuntimeBinderInternalCompilerException rbe = new RuntimeBinderInternalCompilerException(message, inner);
Assert.Same(inner, rbe.InnerException);
+ BinaryFormatterHelpers.AssertRoundtrips(rbe);
}
}
}
diff --git a/src/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs b/src/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs
index 24548b18f1..db93a2d1fa 100644
--- a/src/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs
+++ b/src/Microsoft.Win32.Primitives/src/System/ComponentModel/Win32Exception.cs
@@ -10,6 +10,7 @@ namespace System.ComponentModel
///
/// The exception that is thrown for a Win32 error code.
///
+ [Serializable]
public partial class Win32Exception : ExternalException, ISerializable
{
///
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeArgumentReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeArgumentReferenceExpression.cs
index 33cd9efaf3..ff4dfcaf0f 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeArgumentReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeArgumentReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeArgumentReferenceExpression : CodeExpression
{
private string _parameterName;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeArrayCreateExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeArrayCreateExpression.cs
index 79212864dd..9600e9aa6d 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeArrayCreateExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeArrayCreateExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeArrayCreateExpression : CodeExpression
{
private readonly CodeExpressionCollection _initializers = new CodeExpressionCollection();
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeArrayIndexerExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeArrayIndexerExpression.cs
index ec2e6acc4c..cd71477104 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeArrayIndexerExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeArrayIndexerExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeArrayIndexerExpression : CodeExpression
{
private CodeExpressionCollection _indices;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeAssignStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeAssignStatement.cs
index fdc47b0711..378e9e3c3f 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeAssignStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeAssignStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeAssignStatement : CodeStatement
{
public CodeAssignStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeAttachEventStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeAttachEventStatement.cs
index e76ab8e705..94fe000f5a 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeAttachEventStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeAttachEventStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeAttachEventStatement : CodeStatement
{
private CodeEventReferenceExpression _eventRef;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgument.cs b/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgument.cs
index 2337f8372f..4adfa4b85f 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgument.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgument.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeAttributeArgument
{
private string _name;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgumentCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgumentCollection.cs
index af1f87be6e..5b9c8d40be 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgumentCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeAttributeArgumentCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeAttributeArgumentCollection : CollectionBase
{
public CodeAttributeArgumentCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclaration.cs b/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclaration.cs
index 7a8fe7362b..97e755dd93 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclaration.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclaration.cs
@@ -5,6 +5,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeAttributeDeclaration
{
private string _name;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclarationCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclarationCollection.cs
index e546a7daff..1edc6babc9 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclarationCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeAttributeDeclarationCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeAttributeDeclarationCollection : CollectionBase
{
public CodeAttributeDeclarationCollection()
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeBaseReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeBaseReferenceExpression.cs
index ccd94984a6..12dfa105dd 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeBaseReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeBaseReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeBaseReferenceExpression : CodeExpression
{
}
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeBinaryOperatorExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeBinaryOperatorExpression.cs
index b3e064e8fa..3afcfce160 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeBinaryOperatorExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeBinaryOperatorExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeBinaryOperatorExpression : CodeExpression
{
public CodeBinaryOperatorExpression() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeCastExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeCastExpression.cs
index 076bcae16f..d79e4139f5 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeCastExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeCastExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeCastExpression : CodeExpression
{
private CodeTypeReference _targetType;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeCatchClause.cs b/src/System.CodeDom/src/System/CodeDom/CodeCatchClause.cs
index 8824b7de34..1148558bdd 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeCatchClause.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeCatchClause.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeCatchClause
{
private CodeStatementCollection _statements;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeCatchClauseCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeCatchClauseCollection.cs
index 28377b7664..e85a4cda0a 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeCatchClauseCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeCatchClauseCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeCatchClauseCollection : CollectionBase
{
public CodeCatchClauseCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeChecksumPragma.cs b/src/System.CodeDom/src/System/CodeDom/CodeChecksumPragma.cs
index d757c9dc7c..c00a057d24 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeChecksumPragma.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeChecksumPragma.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeChecksumPragma : CodeDirective
{
private string _fileName;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeComment.cs b/src/System.CodeDom/src/System/CodeDom/CodeComment.cs
index 44fcaac6eb..f531d6989a 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeComment.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeComment.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeComment : CodeObject
{
private string _text;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeCommentStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeCommentStatement.cs
index 463d675771..39c9ed11d9 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeCommentStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeCommentStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeCommentStatement : CodeStatement
{
public CodeCommentStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeCommentStatementCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeCommentStatementCollection.cs
index f27c9188d3..8dd426a9fe 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeCommentStatementCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeCommentStatementCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeCommentStatementCollection : CollectionBase
{
public CodeCommentStatementCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeCompileUnit.cs b/src/System.CodeDom/src/System/CodeDom/CodeCompileUnit.cs
index 71a42d8d1e..c33ab21849 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeCompileUnit.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeCompileUnit.cs
@@ -6,6 +6,7 @@ using System.Collections.Specialized;
namespace System.CodeDom
{
+ [Serializable]
public class CodeCompileUnit : CodeObject
{
private StringCollection _assemblies = null;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeConditionStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeConditionStatement.cs
index 0c3bfaf675..222ec6f748 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeConditionStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeConditionStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeConditionStatement : CodeStatement
{
public CodeConditionStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeConstructor.cs b/src/System.CodeDom/src/System/CodeDom/CodeConstructor.cs
index a2fe34b544..179909cf72 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeConstructor.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeConstructor.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeConstructor : CodeMemberMethod
{
public CodeConstructor()
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeDefaultValueExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeDefaultValueExpression.cs
index 108c1a18a3..82da83ec02 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeDefaultValueExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeDefaultValueExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeDefaultValueExpression : CodeExpression
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeDelegateCreateExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeDelegateCreateExpression.cs
index 834453d8dd..62ccb819eb 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeDelegateCreateExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeDelegateCreateExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeDelegateCreateExpression : CodeExpression
{
private CodeTypeReference _delegateType;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeDelegateInvokeExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeDelegateInvokeExpression.cs
index d1974cd9bd..77da5efc26 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeDelegateInvokeExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeDelegateInvokeExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeDelegateInvokeExpression : CodeExpression
{
public CodeDelegateInvokeExpression() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeDirectionExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeDirectionExpression.cs
index 52e079a854..4bf7c95a94 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeDirectionExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeDirectionExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeDirectionExpression : CodeExpression
{
public CodeDirectionExpression() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeDirective.cs b/src/System.CodeDom/src/System/CodeDom/CodeDirective.cs
index 0b18f00649..5fac4fe915 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeDirective.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeDirective.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeDirective : CodeObject
{
}
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeDirectiveCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeDirectiveCollection.cs
index 59bb228521..cee5e28013 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeDirectiveCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeDirectiveCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeDirectiveCollection : CollectionBase
{
public CodeDirectiveCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeEntryPointMethod.cs b/src/System.CodeDom/src/System/CodeDom/CodeEntryPointMethod.cs
index 0374042b47..5bbc43b91e 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeEntryPointMethod.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeEntryPointMethod.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeEntryPointMethod : CodeMemberMethod
{
public CodeEntryPointMethod() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeEventReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeEventReferenceExpression.cs
index 1c315c6731..174463015a 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeEventReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeEventReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeEventReferenceExpression : CodeExpression
{
private string _eventName;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeExpression.cs
index 4ddb919099..6f54186388 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeExpression : CodeObject
{
}
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeExpressionCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeExpressionCollection.cs
index 8c4af32a5b..0ccc528186 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeExpressionCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeExpressionCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeExpressionCollection : CollectionBase
{
public CodeExpressionCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeExpressionStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeExpressionStatement.cs
index 9568b8b4f5..1699d0fec4 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeExpressionStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeExpressionStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeExpressionStatement : CodeStatement
{
public CodeExpressionStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeFieldReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeFieldReferenceExpression.cs
index 60e4794176..7b9f00e3db 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeFieldReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeFieldReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeFieldReferenceExpression : CodeExpression
{
private string _fieldName;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeGotoStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeGotoStatement.cs
index 39526f565b..d0e0cd5f86 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeGotoStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeGotoStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeGotoStatement : CodeStatement
{
private string _label;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeIndexerExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeIndexerExpression.cs
index 387f28e7c1..394f45cdeb 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeIndexerExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeIndexerExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeIndexerExpression : CodeExpression
{
private CodeExpressionCollection _indices;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeIterationStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeIterationStatement.cs
index ec5421536c..846e98d117 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeIterationStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeIterationStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeIterationStatement : CodeStatement
{
public CodeIterationStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeLabeledStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeLabeledStatement.cs
index 5b66078883..c754279277 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeLabeledStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeLabeledStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeLabeledStatement : CodeStatement
{
private string _label;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeLinePragma.cs b/src/System.CodeDom/src/System/CodeDom/CodeLinePragma.cs
index e7714c55cf..10f95ba547 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeLinePragma.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeLinePragma.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeLinePragma
{
private string _fileName;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeMemberEvent.cs b/src/System.CodeDom/src/System/CodeDom/CodeMemberEvent.cs
index aaa9c3c3f2..60cfc00991 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeMemberEvent.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeMemberEvent.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMemberEvent : CodeTypeMember
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeMemberField.cs b/src/System.CodeDom/src/System/CodeDom/CodeMemberField.cs
index cb742676e4..f2141f755e 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeMemberField.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeMemberField.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMemberField : CodeTypeMember
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeMemberMethod.cs b/src/System.CodeDom/src/System/CodeDom/CodeMemberMethod.cs
index 64a8796d3a..fca2ab350e 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeMemberMethod.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeMemberMethod.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMemberMethod : CodeTypeMember
{
private readonly CodeParameterDeclarationExpressionCollection _parameters = new CodeParameterDeclarationExpressionCollection();
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeMemberProperty.cs b/src/System.CodeDom/src/System/CodeDom/CodeMemberProperty.cs
index 80023af09f..7afbdf0676 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeMemberProperty.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeMemberProperty.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMemberProperty : CodeTypeMember
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeMethodInvokeExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeMethodInvokeExpression.cs
index 44ac1edf2b..732c76ab1c 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeMethodInvokeExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeMethodInvokeExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMethodInvokeExpression : CodeExpression
{
private CodeMethodReferenceExpression _method;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeMethodReturnStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeMethodReturnStatement.cs
index 54a5c0ce3e..47b2db088b 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeMethodReturnStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeMethodReturnStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMethodReturnStatement : CodeStatement
{
public CodeMethodReturnStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeNamespace.cs b/src/System.CodeDom/src/System/CodeDom/CodeNamespace.cs
index ae13f78f75..8f59e5ec24 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeNamespace.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeNamespace.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.CodeDom
{
+ [Serializable]
public class CodeNamespace : CodeObject
{
private string _name;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeNamespaceCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeNamespaceCollection.cs
index 90f2ff4049..e715e904a9 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeNamespaceCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeNamespaceCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeNamespaceCollection : CollectionBase
{
public CodeNamespaceCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImport.cs b/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImport.cs
index b6342e75ca..a2fab04aba 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImport.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImport.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeNamespaceImport : CodeObject
{
private string _nameSpace;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImportCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImportCollection.cs
index b3abb8b14d..a86ecdde90 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImportCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeNamespaceImportCollection.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
namespace System.CodeDom
{
+ [Serializable]
public class CodeNamespaceImportCollection : IList
{
private readonly ArrayList _data = new ArrayList(); // not List to provide desktop-consistent semantics for CopyTo
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeObjectCreateExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeObjectCreateExpression.cs
index 8abaa2e083..3d093e1829 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeObjectCreateExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeObjectCreateExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeObjectCreateExpression : CodeExpression
{
private CodeTypeReference _createType;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpression.cs
index 0b1c9b12a0..7ab88909a3 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeParameterDeclarationExpression : CodeExpression
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpressionCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpressionCollection.cs
index e30d96b967..04309006f5 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpressionCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeParameterDeclarationExpressionCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeParameterDeclarationExpressionCollection : CollectionBase
{
public CodeParameterDeclarationExpressionCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodePrimitiveExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodePrimitiveExpression.cs
index 378555fa93..315407e7ae 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodePrimitiveExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodePrimitiveExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodePrimitiveExpression : CodeExpression
{
public CodePrimitiveExpression() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodePropertyReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodePropertyReferenceExpression.cs
index 3884ec888a..205b14652f 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodePropertyReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodePropertyReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodePropertyReferenceExpression : CodeExpression
{
private string _propertyName;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodePropertySetValueReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodePropertySetValueReferenceExpression.cs
index 0e2ca3bfdd..eb1d8cd3f2 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodePropertySetValueReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodePropertySetValueReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodePropertySetValueReferenceExpression : CodeExpression
{
}
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeRegionDirective.cs b/src/System.CodeDom/src/System/CodeDom/CodeRegionDirective.cs
index 71981062b9..138d05c1ea 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeRegionDirective.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeRegionDirective.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeRegionDirective : CodeDirective
{
private string _regionText;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeRemoveEventStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeRemoveEventStatement.cs
index b33aefe583..6a3c9cbca0 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeRemoveEventStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeRemoveEventStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeRemoveEventStatement : CodeStatement
{
private CodeEventReferenceExpression _eventRef;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeSnippetCompileUnit.cs b/src/System.CodeDom/src/System/CodeDom/CodeSnippetCompileUnit.cs
index 41065a8170..6e93233569 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeSnippetCompileUnit.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeSnippetCompileUnit.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeSnippetCompileUnit : CodeCompileUnit
{
private string _value;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeSnippetExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeSnippetExpression.cs
index 5593127fc9..919248991c 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeSnippetExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeSnippetExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeSnippetExpression : CodeExpression
{
private string _value;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeSnippetStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeSnippetStatement.cs
index 3e853eb0c9..42ac0ec637 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeSnippetStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeSnippetStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeSnippetStatement : CodeStatement
{
private string _value;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeSnippetTypeMember.cs b/src/System.CodeDom/src/System/CodeDom/CodeSnippetTypeMember.cs
index b7041a9243..354d517d57 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeSnippetTypeMember.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeSnippetTypeMember.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeSnippetTypeMember : CodeTypeMember
{
private string _text;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeStatement.cs
index 7d6d4cf2f9..d6a0781a27 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeStatement : CodeObject
{
private CodeDirectiveCollection _startDirectives = null;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeStatementCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeStatementCollection.cs
index 4d5fd34737..4ffb4ed8e4 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeStatementCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeStatementCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeStatementCollection : CollectionBase
{
public CodeStatementCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeThisReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeThisReferenceExpression.cs
index eb4d095f22..03426b3d71 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeThisReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeThisReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeThisReferenceExpression : CodeExpression
{
}
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeThrowExceptionStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeThrowExceptionStatement.cs
index 2901d2171c..c5fa733d38 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeThrowExceptionStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeThrowExceptionStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeThrowExceptionStatement : CodeStatement
{
public CodeThrowExceptionStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTryCatchFinallyStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeTryCatchFinallyStatement.cs
index ac663d83e9..f1ae78eaa8 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTryCatchFinallyStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTryCatchFinallyStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeTryCatchFinallyStatement : CodeStatement
{
public CodeTryCatchFinallyStatement() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeConstructor.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeConstructor.cs
index 18a0eafb71..6c44611a12 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeConstructor.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeConstructor.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeConstructor : CodeMemberMethod
{
public CodeTypeConstructor()
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclaration.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclaration.cs
index 6f9aa2f5c0..7a8860f3f0 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclaration.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclaration.cs
@@ -6,6 +6,7 @@ using System.Reflection;
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeDeclaration : CodeTypeMember
{
private readonly CodeTypeReferenceCollection _baseTypes = new CodeTypeReferenceCollection();
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclarationCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclarationCollection.cs
index a7ee9500e4..04cd682826 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclarationCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeDeclarationCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeDeclarationCollection : CollectionBase
{
public CodeTypeDeclarationCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeDelegate.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeDelegate.cs
index 33453bf40b..6d91e310b9 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeDelegate.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeDelegate.cs
@@ -6,6 +6,7 @@ using System.Reflection;
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeDelegate : CodeTypeDeclaration
{
private CodeTypeReference _returnType;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeMember.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeMember.cs
index fa2c1bd080..5963ca1d71 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeMember.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeMember.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeMember : CodeObject
{
private string _name;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeMemberCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeMemberCollection.cs
index 3af2f86778..1a636a0c27 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeMemberCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeMemberCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeMemberCollection : CollectionBase
{
public CodeTypeMemberCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeOfExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeOfExpression.cs
index 61a3caeaf5..ee19617c4e 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeOfExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeOfExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeOfExpression : CodeExpression
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeParameter.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeParameter.cs
index 51b4c1c9b2..45a85e3278 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeParameter.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeParameter.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeParameter : CodeObject
{
private string _name;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeParameterCollection.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeParameterCollection.cs
index 4cea3dd1c6..630b36fff4 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeParameterCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeParameterCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeParameterCollection : CollectionBase
{
public CodeTypeParameterCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeTypeReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeTypeReferenceExpression.cs
index 63077b4d95..475d5e0ebb 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeTypeReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeTypeReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeTypeReferenceExpression : CodeExpression
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeVariableDeclarationStatement.cs b/src/System.CodeDom/src/System/CodeDom/CodeVariableDeclarationStatement.cs
index 513dfb8c7c..159299952a 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeVariableDeclarationStatement.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeVariableDeclarationStatement.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeVariableDeclarationStatement : CodeStatement
{
private CodeTypeReference _type;
diff --git a/src/System.CodeDom/src/System/CodeDom/CodeVariableReferenceExpression.cs b/src/System.CodeDom/src/System/CodeDom/CodeVariableReferenceExpression.cs
index 83f4333616..f3b2891bb6 100644
--- a/src/System.CodeDom/src/System/CodeDom/CodeVariableReferenceExpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/CodeVariableReferenceExpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeVariableReferenceExpression : CodeExpression
{
private string _variableName;
diff --git a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerError.cs b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerError.cs
index f1bf4b0584..6a7f8befd6 100644
--- a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerError.cs
+++ b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerError.cs
@@ -6,6 +6,7 @@ using System.Globalization;
namespace System.CodeDom.Compiler
{
+ [Serializable]
public class CompilerError
{
public CompilerError() : this(string.Empty, 0, 0, string.Empty, string.Empty) { }
diff --git a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerErrorCollection.cs b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerErrorCollection.cs
index d454b24d47..ddc749c6ce 100644
--- a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerErrorCollection.cs
+++ b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerErrorCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.CodeDom.Compiler
{
+ [Serializable]
public class CompilerErrorCollection : CollectionBase
{
public CompilerErrorCollection() { }
diff --git a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs
index 2f5ed6890e..c441201a43 100644
--- a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs
+++ b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerParameters.cs
@@ -6,6 +6,7 @@ using System.Collections.Specialized;
namespace System.CodeDom.Compiler
{
+ [Serializable]
public partial class CompilerParameters
{
private readonly StringCollection _assemblyNames = new StringCollection();
diff --git a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs
index c6d71f494b..b74d2c7759 100644
--- a/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs
+++ b/src/System.CodeDom/src/System/CodeDom/Compiler/CompilerResults.cs
@@ -7,6 +7,7 @@ using System.Reflection;
namespace System.CodeDom.Compiler
{
+ [Serializable]
public partial class CompilerResults
{
private readonly CompilerErrorCollection _errors = new CompilerErrorCollection();
diff --git a/src/System.CodeDom/src/System/CodeDom/codemethodreferenceexpression.cs b/src/System.CodeDom/src/System/CodeDom/codemethodreferenceexpression.cs
index fcdcb6b182..63794ceb33 100644
--- a/src/System.CodeDom/src/System/CodeDom/codemethodreferenceexpression.cs
+++ b/src/System.CodeDom/src/System/CodeDom/codemethodreferenceexpression.cs
@@ -4,6 +4,7 @@
namespace System.CodeDom
{
+ [Serializable]
public class CodeMethodReferenceExpression : CodeExpression
{
private string _methodName;
diff --git a/src/System.CodeDom/tests/CodeGenerationTests.cs b/src/System.CodeDom/tests/CodeGenerationTests.cs
index c79a0f9fa3..79749310f6 100644
--- a/src/System.CodeDom/tests/CodeGenerationTests.cs
+++ b/src/System.CodeDom/tests/CodeGenerationTests.cs
@@ -121,6 +121,12 @@ namespace System.CodeDom.Tests
Console.WriteLine(code);
throw;
}
+
+ // Serialize and deserialize the CodeObject, and make sure code generated for it
+ // is the same as the original.
+ CodeObject clone = BinaryFormatterHelpers.Clone(c);
+ string cloneCode = GenerateCode(clone, provider);
+ Assert.Equal(code, cloneCode);
}
private static string GenerateCode(CodeObject c, CodeDomProvider provider)
diff --git a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs
index 783449d9d4..f978081368 100644
--- a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs
+++ b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs
@@ -30,6 +30,7 @@ namespace System.Collections.Concurrent
///
[DebuggerTypeProxy(typeof(IProducerConsumerCollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
+ [Serializable]
public class ConcurrentBag : IProducerConsumerCollection, IReadOnlyCollection
{
/// The per-bag, per-thread work-stealing queues.
@@ -1049,6 +1050,7 @@ namespace System.Collections.Concurrent
/// we use a custom enumerator rather than just returning array's. This enumerator provides
/// the essential elements of both list's and array's enumerators.
///
+ [Serializable]
private sealed class Enumerator : IEnumerator
{
private readonly T[] _array;
diff --git a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs
index 13cb4ec8f3..5fb7b19864 100644
--- a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs
+++ b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs
@@ -34,6 +34,7 @@ namespace System.Collections.Concurrent
///
[DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
+ [Serializable]
public class ConcurrentDictionary : IDictionary, IDictionary, IReadOnlyDictionary
{
///
@@ -2035,6 +2036,7 @@ namespace System.Collections.Concurrent
///
/// A node in a singly-linked list representing a particular hash table bucket.
///
+ [Serializable]
private sealed class Node
{
internal readonly TKey _key;
@@ -2055,6 +2057,7 @@ namespace System.Collections.Concurrent
/// A private class to represent enumeration over the dictionary that implements the
/// IDictionaryEnumerator interface.
///
+ [Serializable]
private sealed class DictionaryEnumerator : IDictionaryEnumerator
{
IEnumerator> _enumerator; // Enumerator over the dictionary.
diff --git a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs
index 27bc80665c..806658e064 100644
--- a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs
+++ b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs
@@ -21,6 +21,7 @@ namespace System.Collections.Concurrent
///
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(IProducerConsumerCollectionDebugView<>))]
+ [Serializable]
public class ConcurrentQueue : IProducerConsumerCollection, IReadOnlyCollection
{
// This implementation provides an unbounded, multi-producer multi-consumer queue
diff --git a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs
index c6a0e97e51..31680a4844 100644
--- a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs
+++ b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs
@@ -38,11 +38,13 @@ namespace System.Collections.Concurrent
///
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(IProducerConsumerCollectionDebugView<>))]
+ [Serializable]
public class ConcurrentStack : IProducerConsumerCollection, IReadOnlyCollection
{
///
/// A simple (internal) node type used to store elements of concurrent stacks and queues.
///
+ [Serializable]
private class Node
{
internal readonly T _value; // Value of the node.
diff --git a/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.NonGeneric.Tests.cs b/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.NonGeneric.Tests.cs
index 38c96db225..b59782a7a0 100644
--- a/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.NonGeneric.Tests.cs
+++ b/src/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.NonGeneric.Tests.cs
@@ -49,8 +49,6 @@ namespace System.Collections.Concurrent.Tests
protected override bool IDictionary_NonGeneric_Keys_Values_Enumeration_ResetImplemented => true;
- protected override bool SupportsSerialization => false;
-
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectReferenceType_ThrowType => typeof(ArrayTypeMismatchException);
#endregion
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveComparer.cs b/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveComparer.cs
index 2caec2d712..86b3afd2db 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveComparer.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveComparer.cs
@@ -16,6 +16,7 @@ using System.Diagnostics.Contracts;
namespace System.Collections
{
+ [Serializable]
public class CaseInsensitiveComparer : IComparer
{
private CompareInfo _compareInfo;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveHashCodeProvider.cs b/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveHashCodeProvider.cs
index 7aca0e17de..cbcd77f39f 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveHashCodeProvider.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/CaseInsensitiveHashCodeProvider.cs
@@ -11,6 +11,7 @@ namespace System.Collections
/// this provides an efficient mechanism for getting the hashcode of the string ignoring case.
///
[Obsolete("Please use StringComparer instead.")]
+ [Serializable]
public class CaseInsensitiveHashCodeProvider : IHashCodeProvider
{
private static volatile CaseInsensitiveHashCodeProvider s_invariantCaseInsensitiveHashCodeProvider = null;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/CollectionBase.cs b/src/System.Collections.NonGeneric/src/System/Collections/CollectionBase.cs
index 9fe9963ba5..0bb5c8a6b6 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/CollectionBase.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/CollectionBase.cs
@@ -15,6 +15,7 @@ using System.Diagnostics.Contracts;
namespace System.Collections
{
// Useful base class for typed read/write collections where items derive from object
+ [Serializable]
public abstract class CollectionBase : IList
{
private ArrayList _list;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/DictionaryBase.cs b/src/System.Collections.NonGeneric/src/System/Collections/DictionaryBase.cs
index 99a89b4444..08b0adaa03 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/DictionaryBase.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/DictionaryBase.cs
@@ -15,6 +15,7 @@
namespace System.Collections
{
// Useful base class for typed read/write collections where items derive from object
+ [Serializable]
public abstract class DictionaryBase : IDictionary
{
private Hashtable _hashtable;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/Queue.cs b/src/System.Collections.NonGeneric/src/System/Collections/Queue.cs
index a241876039..d11a4b456f 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/Queue.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/Queue.cs
@@ -321,6 +321,7 @@ namespace System.Collections
// Implements a synchronization wrapper around a queue.
+ [Serializable]
private class SynchronizedQueue : Queue
{
private Queue _q;
@@ -443,6 +444,7 @@ namespace System.Collections
// Implements an enumerator for a Queue. The enumerator uses the
// internal version number of the list to ensure that no modifications are
// made to the list while an enumeration is in progress.
+ [Serializable]
private class QueueEnumerator : IEnumerator, ICloneable
{
private Queue _q;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/ReadOnlyCollectionBase.cs b/src/System.Collections.NonGeneric/src/System/Collections/ReadOnlyCollectionBase.cs
index 097013e94f..d60e8eed54 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/ReadOnlyCollectionBase.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/ReadOnlyCollectionBase.cs
@@ -15,6 +15,7 @@
namespace System.Collections
{
// Useful base class for typed readonly collections where items derive from object
+ [Serializable]
public abstract class ReadOnlyCollectionBase : ICollection
{
private ArrayList _list;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs b/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs
index 220b788973..ed5d97aa5b 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs
@@ -610,6 +610,7 @@ namespace System.Collections
Capacity = _size;
}
+ [Serializable]
private class SyncSortedList : SortedList
{
private SortedList _list;
@@ -830,6 +831,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class SortedListEnumerator : IDictionaryEnumerator, ICloneable
{
private SortedList _sortedList;
@@ -932,6 +934,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class KeyList : IList
{
private SortedList _sortedList;
@@ -1037,6 +1040,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class ValueList : IList
{
private SortedList _sortedList;
diff --git a/src/System.Collections.NonGeneric/src/System/Collections/Stack.cs b/src/System.Collections.NonGeneric/src/System/Collections/Stack.cs
index c18d7ca123..a1a1903f16 100644
--- a/src/System.Collections.NonGeneric/src/System/Collections/Stack.cs
+++ b/src/System.Collections.NonGeneric/src/System/Collections/Stack.cs
@@ -241,6 +241,7 @@ namespace System.Collections
return objArray;
}
+ [Serializable]
private class SyncStack : Stack
{
private Stack _s;
@@ -351,6 +352,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class StackEnumerator : IEnumerator, ICloneable
{
private Stack _stack;
diff --git a/src/System.Collections.NonGeneric/tests/ArrayList/ArrayList.IList.Tests.cs b/src/System.Collections.NonGeneric/tests/ArrayList/ArrayList.IList.Tests.cs
index ac439178d4..2c189c7e77 100644
--- a/src/System.Collections.NonGeneric/tests/ArrayList/ArrayList.IList.Tests.cs
+++ b/src/System.Collections.NonGeneric/tests/ArrayList/ArrayList.IList.Tests.cs
@@ -9,7 +9,6 @@ namespace System.Collections.Tests
{
public class ArrayListBasicTests : ArrayListIListTestBase
{
- protected override bool SupportsSerialization => true;
protected override IList NonGenericIListFactory() => new ArrayList();
}
@@ -78,8 +77,6 @@ namespace System.Collections.Tests
public abstract class ArrayListIListTestBase : IList_NonGeneric_Tests
{
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
- // ArrayList supports serialization, but its nested types don't
- protected override bool SupportsSerialization => false;
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(InvalidCastException);
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectReferenceType_ThrowType => typeof(InvalidCastException);
diff --git a/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.IDictionary.Tests.cs b/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.IDictionary.Tests.cs
index 493dcefc77..51a8b6f6ee 100644
--- a/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.IDictionary.Tests.cs
+++ b/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.IDictionary.Tests.cs
@@ -14,7 +14,6 @@ namespace System.Collections.Tests
public class HashtableSynchronizedTests : HashtableIDictionaryTestBase
{
protected override bool ExpectedIsSynchronized => true;
- protected override bool SupportsSerialization => false;
protected override IDictionary NonGenericIDictionaryFactory() => Hashtable.Synchronized(new Hashtable());
}
diff --git a/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Keys.Tests.cs b/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Keys.Tests.cs
index 56c8a416e2..ba78ffa4f3 100644
--- a/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Keys.Tests.cs
+++ b/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Keys.Tests.cs
@@ -15,7 +15,6 @@ namespace System.Collections.Tests
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfIncorrectValueType_ThrowType => typeof(InvalidCastException);
protected override bool IsReadOnly => true;
protected override EnumerableOrder Order => EnumerableOrder.Unspecified;
- protected override bool SupportsSerialization => false;
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
protected override IEnumerable ModifyEnumerables => new List();
diff --git a/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Values.Tests.cs b/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Values.Tests.cs
index 86f57a087e..e296630624 100644
--- a/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Values.Tests.cs
+++ b/src/System.Collections.NonGeneric/tests/Hashtable/Hashtable.Values.Tests.cs
@@ -16,7 +16,6 @@ namespace System.Collections.Tests
protected override bool IsReadOnly => true;
protected override EnumerableOrder Order => EnumerableOrder.Unspecified;
- protected override bool SupportsSerialization => false;
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
protected override IEnumerable ModifyEnumerables => new List();
diff --git a/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs b/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
index 6d88b829d4..f7770e6eff 100644
--- a/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
+++ b/src/System.Collections.Specialized/src/System/Collections/Specialized/ListDictionary.cs
@@ -492,7 +492,7 @@ namespace System.Collections.Specialized
}
[Serializable]
- public class DictionaryNode
+ private class DictionaryNode
{
public object key;
public object value;
diff --git a/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs b/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs
index 9646c9ff36..c0e8cb0767 100644
--- a/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs
+++ b/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs
@@ -636,6 +636,7 @@ namespace System.Collections.Specialized
// Enumerator over keys of NameObjectCollection
//
+ [Serializable]
internal class NameObjectKeysEnumerator : IEnumerator
{
private int _pos;
@@ -696,6 +697,7 @@ namespace System.Collections.Specialized
///
/// Represents a collection of the keys of a collection.
///
+ [Serializable]
public class KeysCollection : ICollection
{
private NameObjectCollectionBase _coll;
diff --git a/src/System.Collections/src/System/Collections/BitArray.cs b/src/System.Collections/src/System/Collections/BitArray.cs
index 0771eac81c..75bc51996e 100644
--- a/src/System.Collections/src/System/Collections/BitArray.cs
+++ b/src/System.Collections/src/System/Collections/BitArray.cs
@@ -644,6 +644,7 @@ namespace System.Collections
return n > 0 ? (((n - 1) / div) + 1) : 0;
}
+ [Serializable]
private class BitArrayEnumeratorSimple : IEnumerator, ICloneable
{
private BitArray bitarray;
diff --git a/src/System.Collections/src/System/Collections/Generic/HashSet.cs b/src/System.Collections/src/System/Collections/Generic/HashSet.cs
index 752f2cde15..c8fc7c0090 100644
--- a/src/System.Collections/src/System/Collections/Generic/HashSet.cs
+++ b/src/System.Collections/src/System/Collections/Generic/HashSet.cs
@@ -1757,6 +1757,7 @@ namespace System.Collections.Generic
internal T value;
}
+ [Serializable]
public struct Enumerator : IEnumerator, IEnumerator
{
private HashSet _set;
diff --git a/src/System.Collections/src/System/Collections/Generic/HashSetEqualityComparer.cs b/src/System.Collections/src/System/Collections/Generic/HashSetEqualityComparer.cs
index 1697cd6744..0860b53a65 100644
--- a/src/System.Collections/src/System/Collections/Generic/HashSetEqualityComparer.cs
+++ b/src/System.Collections/src/System/Collections/Generic/HashSetEqualityComparer.cs
@@ -13,6 +13,7 @@ namespace System.Collections.Generic
/// Equality comparer for hashsets of hashsets
///
///
+ [Serializable]
internal sealed class HashSetEqualityComparer : IEqualityComparer>
{
private readonly IEqualityComparer _comparer;
diff --git a/src/System.Collections/src/System/Collections/Generic/LinkedList.cs b/src/System.Collections/src/System/Collections/Generic/LinkedList.cs
index 2b9099403e..3a955c9495 100644
--- a/src/System.Collections/src/System/Collections/Generic/LinkedList.cs
+++ b/src/System.Collections/src/System/Collections/Generic/LinkedList.cs
@@ -537,6 +537,7 @@ namespace System.Collections.Generic
}
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
+ [Serializable]
public struct Enumerator : IEnumerator, IEnumerator, ISerializable, IDeserializationCallback
{
private LinkedList _list;
diff --git a/src/System.Collections/src/System/Collections/Generic/Queue.cs b/src/System.Collections/src/System/Collections/Generic/Queue.cs
index 7ea3f6d84d..4d39ccd77d 100644
--- a/src/System.Collections/src/System/Collections/Generic/Queue.cs
+++ b/src/System.Collections/src/System/Collections/Generic/Queue.cs
@@ -391,6 +391,7 @@ namespace System.Collections.Generic
// internal version number of the list to ensure that no modifications are
// made to the list while an enumeration is in progress.
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
+ [Serializable]
public struct Enumerator : IEnumerator,
System.Collections.IEnumerator
{
diff --git a/src/System.Collections/src/System/Collections/Generic/SortedDictionary.cs b/src/System.Collections/src/System/Collections/Generic/SortedDictionary.cs
index 3515aa6c40..a8dc0a0f2b 100644
--- a/src/System.Collections/src/System/Collections/Generic/SortedDictionary.cs
+++ b/src/System.Collections/src/System/Collections/Generic/SortedDictionary.cs
@@ -554,6 +554,7 @@ namespace System.Collections.Generic
[DebuggerTypeProxy(typeof(DictionaryKeyCollectionDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
+ [Serializable]
public sealed class KeyCollection : ICollection, ICollection, IReadOnlyCollection
{
private SortedDictionary _dictionary;
@@ -738,6 +739,7 @@ namespace System.Collections.Generic
[DebuggerTypeProxy(typeof(DictionaryValueCollectionDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
+ [Serializable]
public sealed class ValueCollection : ICollection, ICollection, IReadOnlyCollection
{
private SortedDictionary _dictionary;
@@ -921,7 +923,7 @@ namespace System.Collections.Generic
}
[Serializable]
- public sealed class KeyValuePairComparer : Comparer>
+ internal sealed class KeyValuePairComparer : Comparer>
{
internal IComparer keyComparer;
@@ -955,7 +957,7 @@ namespace System.Collections.Generic
///
///
[Serializable]
- public sealed class TreeSet : SortedSet
+ internal sealed class TreeSet : SortedSet
{
public TreeSet()
: base()
@@ -963,7 +965,7 @@ namespace System.Collections.Generic
public TreeSet(IComparer comparer) : base(comparer) { }
- private TreeSet(SerializationInfo siInfo, StreamingContext context) : base(siInfo, context) { }
+ public TreeSet(SerializationInfo siInfo, StreamingContext context) : base(siInfo, context) { }
internal override bool AddIfNotPresent(T item)
{
diff --git a/src/System.Collections/src/System/Collections/Generic/SortedList.cs b/src/System.Collections/src/System/Collections/Generic/SortedList.cs
index 056c963fd8..e59f792612 100644
--- a/src/System.Collections/src/System/Collections/Generic/SortedList.cs
+++ b/src/System.Collections/src/System/Collections/Generic/SortedList.cs
@@ -770,6 +770,7 @@ namespace System.Collections.Generic
return (key is TKey);
}
+ [Serializable]
private struct Enumerator : IEnumerator>, IDictionaryEnumerator
{
private SortedList _sortedList;
@@ -897,6 +898,7 @@ namespace System.Collections.Generic
}
}
+ [Serializable]
private sealed class SortedListKeyEnumerator : IEnumerator, IEnumerator
{
private SortedList _sortedList;
@@ -967,6 +969,7 @@ namespace System.Collections.Generic
}
}
+ [Serializable]
private sealed class SortedListValueEnumerator : IEnumerator, IEnumerator
{
private SortedList _sortedList;
@@ -1040,7 +1043,7 @@ namespace System.Collections.Generic
[DebuggerTypeProxy(typeof(DictionaryKeyCollectionDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
- public sealed class KeyList : IList, ICollection
+ private sealed class KeyList : IList, ICollection
{
private SortedList _dict;
@@ -1159,7 +1162,7 @@ namespace System.Collections.Generic
[DebuggerTypeProxy(typeof(DictionaryValueCollectionDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
- public sealed class ValueList : IList, ICollection
+ private sealed class ValueList : IList, ICollection
{
private SortedList _dict;
diff --git a/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs b/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs
index 88b36dd341..189bf8a850 100644
--- a/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs
+++ b/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs
@@ -13,6 +13,7 @@ namespace System.Collections.Generic
/// This class represents a subset view into the tree. Any changes to this view
/// are reflected in the actual tree. It uses the comparer of the underlying tree.
///
+ [Serializable]
internal sealed class TreeSubSet : SortedSet, ISerializable, IDeserializationCallback
{
private SortedSet _underlying;
diff --git a/src/System.Collections/src/System/Collections/Generic/SortedSet.cs b/src/System.Collections/src/System/Collections/Generic/SortedSet.cs
index 4c2fc5cb84..9376cc7795 100644
--- a/src/System.Collections/src/System/Collections/Generic/SortedSet.cs
+++ b/src/System.Collections/src/System/Collections/Generic/SortedSet.cs
@@ -1718,6 +1718,7 @@ namespace System.Collections.Generic
#region Helper classes
+ [Serializable]
internal sealed class Node
{
public Node(T item, bool isRed)
@@ -1850,6 +1851,7 @@ namespace System.Collections.Generic
}
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
+ [Serializable]
public struct Enumerator : IEnumerator, IEnumerator, ISerializable, IDeserializationCallback
{
private static readonly Node s_dummyNode = new Node(default(T), isRed: true);
diff --git a/src/System.Collections/src/System/Collections/Generic/Stack.cs b/src/System.Collections/src/System/Collections/Generic/Stack.cs
index 5bf7bc3356..2e87855472 100644
--- a/src/System.Collections/src/System/Collections/Generic/Stack.cs
+++ b/src/System.Collections/src/System/Collections/Generic/Stack.cs
@@ -289,6 +289,7 @@ namespace System.Collections.Generic
}
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
+ [Serializable]
public struct Enumerator : IEnumerator, System.Collections.IEnumerator
{
private readonly Stack _stack;
diff --git a/src/System.Collections/src/System/Collections/StructuralComparisons.cs b/src/System.Collections/src/System/Collections/StructuralComparisons.cs
index a062acd5f8..184d1ed045 100644
--- a/src/System.Collections/src/System/Collections/StructuralComparisons.cs
+++ b/src/System.Collections/src/System/Collections/StructuralComparisons.cs
@@ -40,6 +40,7 @@ namespace System.Collections
}
}
+ [Serializable]
internal sealed class StructuralEqualityComparer : IEqualityComparer
{
public new bool Equals(object x, object y)
@@ -81,6 +82,7 @@ namespace System.Collections
}
}
+ [Serializable]
internal sealed class StructuralComparer : IComparer
{
public int Compare(object x, object y)
diff --git a/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Keys.cs b/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Keys.cs
index f002bd138b..32939e1230 100644
--- a/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Keys.cs
+++ b/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Keys.cs
@@ -68,7 +68,6 @@ namespace System.Collections.Tests
{
return (ICollection)(new SortedDictionary().Keys);
}
- protected override bool SupportsSerialization { get { return false; } }
protected override ICollection NonGenericICollectionFactory(int count)
{
diff --git a/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Values.cs b/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Values.cs
index 351029f4fc..5d30764606 100644
--- a/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Values.cs
+++ b/src/System.Collections/tests/Generic/SortedDictionary/SortedDictionary.Generic.Tests.Values.cs
@@ -64,7 +64,6 @@ namespace System.Collections.Tests
protected override bool IsReadOnly { get { return true; } }
protected override bool Enumerator_Current_UndefinedOperation_Throws { get { return true; } }
protected override IEnumerable ModifyEnumerables { get { return new List(); } }
- protected override bool SupportsSerialization { get { return false; } }
protected override ICollection NonGenericICollectionFactory()
{
diff --git a/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Keys.cs b/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Keys.cs
index 9e207109c5..db2437c04d 100644
--- a/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Keys.cs
+++ b/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Keys.cs
@@ -59,7 +59,6 @@ namespace System.Collections.Tests
protected override bool DuplicateValuesAllowed => false;
protected override bool IsReadOnly => true;
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
- protected override bool SupportsSerialization => false;
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(ArgumentException);
protected override Type ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType => typeof(ArgumentOutOfRangeException);
diff --git a/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Values.cs b/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Values.cs
index cf880f291b..5e9c912458 100644
--- a/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Values.cs
+++ b/src/System.Collections/tests/Generic/SortedList/SortedList.Generic.Tests.Values.cs
@@ -58,7 +58,6 @@ namespace System.Collections.Tests
protected override bool DuplicateValuesAllowed => true;
protected override bool IsReadOnly => true;
protected override bool Enumerator_Current_UndefinedOperation_Throws => true;
- protected override bool SupportsSerialization => false;
protected override Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(ArgumentException);
protected override Type ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType => typeof(ArgumentOutOfRangeException);
diff --git a/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs b/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs
index 088adef363..e8dd66bc4b 100644
--- a/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs
+++ b/src/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationException.cs
@@ -9,6 +9,7 @@ namespace System.ComponentModel.DataAnnotations
///
/// Exception used for validation using .
///
+ [Serializable]
public class ValidationException : Exception
{
private ValidationResult _validationResult;
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs
index 6490279d60..9fb219a884 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs
@@ -18,6 +18,7 @@ namespace System.ComponentModel.Design
/// a source control program.
///
///
+ [Serializable]
public class CheckoutException : ExternalException
{
private const int E_ABORT = unchecked((int)0x80004004);
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/HelpKeywordAttribute.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/HelpKeywordAttribute.cs
index eaf7de00d0..ea8e88d70c 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/HelpKeywordAttribute.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/HelpKeywordAttribute.cs
@@ -44,6 +44,7 @@ namespace System.ComponentModel.Design
///
///
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
+ [Serializable]
public sealed class HelpKeywordAttribute : Attribute
{
///
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs
index df9ab63f95..2bcd4edf61 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs
@@ -9,6 +9,7 @@ namespace System.ComponentModel
///
/// The exception that is thrown when a thread that an operation should execute on no longer exists or is not pumping messages
///
+ [Serializable]
public class InvalidAsynchronousStateException : ArgumentException
{
///
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidEnumArgumentException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidEnumArgumentException.cs
index 21464c5ddd..b3ecdb1209 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidEnumArgumentException.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidEnumArgumentException.cs
@@ -14,6 +14,7 @@ namespace System.ComponentModel
///
/// The exception that is thrown when using invalid arguments that are enumerators.
///
+ [Serializable]
public class InvalidEnumArgumentException : ArgumentException
{
///
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs
index 2c8ffecf85..a60ae92ae3 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs
@@ -14,6 +14,7 @@ namespace System.ComponentModel
/// Represents the exception thrown when a component cannot be granted a license.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] // must not, a Type is required in all constructors.
+ [Serializable]
public class LicenseException : SystemException
{
private object _instance;
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs
index ed0fbc4c2d..9d88eb395b 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/ToolboxItemFilterAttribute.cs
@@ -44,7 +44,10 @@ namespace System.ComponentModel
/// they may not know which controls to choose.
///
///
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
+ [
+ AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true),
+ Serializable
+ ]
public sealed class ToolboxItemFilterAttribute : Attribute
{
private string _typeId;
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs
index f15a1d8ac8..0d0414786a 100644
--- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs
+++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs
@@ -14,6 +14,7 @@ namespace System.ComponentModel
///
/// Specifies an exception that is handled as a warning instead of an error.
///
+ [Serializable]
public class WarningException : SystemException
{
///
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationErrorsException.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationErrorsException.cs
index d59cec4e0d..43031cd564 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationErrorsException.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationErrorsException.cs
@@ -13,6 +13,7 @@ using System.Xml;
namespace System.Configuration
{
+ [Serializable]
public class ConfigurationErrorsException : ConfigurationException
{
// Constants
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationException.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationException.cs
index d03a43f223..69e63b71d3 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationException.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationException.cs
@@ -16,6 +16,7 @@ namespace System.Configuration
/// line
/// number information where possible.
///
+ [Serializable]
public class ConfigurationException : SystemException
{
private string _filename;
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionCollection.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionCollection.cs
index 320eb4381e..ff9840f193 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionCollection.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionCollection.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public sealed class ConfigurationSectionCollection : NameObjectCollectionBase
{
private readonly ConfigurationSectionGroup _configSectionGroup;
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionGroupCollection.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionGroupCollection.cs
index 5059228bcc..2ccfb72bd5 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionGroupCollection.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationSectionGroupCollection.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public sealed class ConfigurationSectionGroupCollection : NameObjectCollectionBase
{
private readonly ConfigurationSectionGroup _configSectionGroup;
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/PropertyInformationCollection.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/PropertyInformationCollection.cs
index 067af4ba50..d716a85966 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/PropertyInformationCollection.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/PropertyInformationCollection.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public sealed class PropertyInformationCollection : NameObjectCollectionBase
{
internal PropertyInformationCollection(ConfigurationElement thisElement) : base(StringComparer.Ordinal)
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/Provider/ProviderException.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/Provider/ProviderException.cs
index 45eb51765a..337026a0ec 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/Provider/ProviderException.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/Provider/ProviderException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Configuration.Provider
{
+ [Serializable]
public class ProviderException : Exception
{
public ProviderException() { }
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SafeBitVector32.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SafeBitVector32.cs
index 01882e1281..6d8e9b1b1f 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SafeBitVector32.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SafeBitVector32.cs
@@ -7,6 +7,7 @@ using System.Threading;
namespace System.Configuration
{
// This is a multithreadsafe version of System.Collections.Specialized.BitVector32.
+ [Serializable]
internal struct SafeBitVector32
{
private volatile int _data;
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsAttributeDictionary.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsAttributeDictionary.cs
index 54427e8131..1a0135c174 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsAttributeDictionary.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsAttributeDictionary.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public class SettingsAttributeDictionary : Hashtable
{
public SettingsAttributeDictionary() : base() { }
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsContext.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsContext.cs
index 5b2e36b015..79c20655cc 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsContext.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsContext.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public class SettingsContext : Hashtable
{
public SettingsContext() : base() { }
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyIsReadOnlyException.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyIsReadOnlyException.cs
index 485ab107d1..5535b7c2f3 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyIsReadOnlyException.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyIsReadOnlyException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public class SettingsPropertyIsReadOnlyException : Exception
{
public SettingsPropertyIsReadOnlyException(String message)
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyNotFoundException.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyNotFoundException.cs
index 1afe1783ef..94072127e5 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyNotFoundException.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyNotFoundException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public class SettingsPropertyNotFoundException : Exception
{
public SettingsPropertyNotFoundException(String message)
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyWrongTypeException.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyWrongTypeException.cs
index 8dd9bf575e..47a343c0da 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyWrongTypeException.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SettingsPropertyWrongTypeException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Configuration
{
+ [Serializable]
public class SettingsPropertyWrongTypeException : Exception
{
public SettingsPropertyWrongTypeException(String message)
diff --git a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SimpleBitVector32.cs b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SimpleBitVector32.cs
index d6ef82bbc2..a7c76e41d7 100644
--- a/src/System.Configuration.ConfigurationManager/src/System/Configuration/SimpleBitVector32.cs
+++ b/src/System.Configuration.ConfigurationManager/src/System/Configuration/SimpleBitVector32.cs
@@ -8,6 +8,7 @@ namespace System.Configuration
// reason this is here is because it is used rather intensively by Control and
// WebControl. As a result, being able to inline this operations results in a
// measurable performance gain, at the expense of some maintainability.
+ [Serializable]
internal struct SimpleBitVector32
{
internal SimpleBitVector32(int data)
diff --git a/src/System.Console/src/System/ConsoleCancelEventArgs.cs b/src/System.Console/src/System/ConsoleCancelEventArgs.cs
index 58ae18f7a1..86654d4068 100644
--- a/src/System.Console/src/System/ConsoleCancelEventArgs.cs
+++ b/src/System.Console/src/System/ConsoleCancelEventArgs.cs
@@ -7,6 +7,7 @@ namespace System
public delegate void ConsoleCancelEventHandler(Object sender, ConsoleCancelEventArgs e);
+ [Serializable]
public sealed class ConsoleCancelEventArgs : EventArgs
{
private readonly ConsoleSpecialKey _type;
diff --git a/src/System.Console/src/System/ConsoleKeyInfo.cs b/src/System.Console/src/System/ConsoleKeyInfo.cs
index 19879ce93f..87bd61fa4f 100644
--- a/src/System.Console/src/System/ConsoleKeyInfo.cs
+++ b/src/System.Console/src/System/ConsoleKeyInfo.cs
@@ -4,6 +4,7 @@
namespace System
{
+ [Serializable]
public struct ConsoleKeyInfo
{
private readonly char _keyChar;
diff --git a/src/System.Console/src/System/IO/SyncTextReader.cs b/src/System.Console/src/System/IO/SyncTextReader.cs
index d96c3baa4e..ec4af00cd9 100644
--- a/src/System.Console/src/System/IO/SyncTextReader.cs
+++ b/src/System.Console/src/System/IO/SyncTextReader.cs
@@ -12,6 +12,7 @@ namespace System.IO
/* SyncTextReader intentionally locks on itself rather than a private lock object.
* This is done to synchronize different console readers(Issue#2855).
*/
+ [Serializable]
internal sealed partial class SyncTextReader : TextReader
{
internal readonly TextReader _in;
diff --git a/src/System.Console/src/System/IO/SyncTextWriter.cs b/src/System.Console/src/System/IO/SyncTextWriter.cs
index af08df3493..f2c90724a8 100644
--- a/src/System.Console/src/System/IO/SyncTextWriter.cs
+++ b/src/System.Console/src/System/IO/SyncTextWriter.cs
@@ -13,6 +13,7 @@ namespace System.IO
* For example - colored console writers can be synchronized with non-colored
* writers by locking on Console.On (Issue#2855).
*/
+ [Serializable]
internal sealed class SyncTextWriter : TextWriter, IDisposable
{
internal readonly TextWriter _out;
diff --git a/src/System.Data.Common/src/System/Data/Common/DbException.cs b/src/System.Data.Common/src/System/Data/Common/DbException.cs
index d296804903..75560aec28 100644
--- a/src/System.Data.Common/src/System/Data/Common/DbException.cs
+++ b/src/System.Data.Common/src/System/Data/Common/DbException.cs
@@ -4,6 +4,7 @@
namespace System.Data.Common
{
+ [Serializable]
public abstract class DbException : System.Runtime.InteropServices.ExternalException
{
protected DbException() : base() { }
diff --git a/src/System.Data.Common/src/System/Data/Common/DbProviderSpecificTypePropertyAttribute.cs b/src/System.Data.Common/src/System/Data/Common/DbProviderSpecificTypePropertyAttribute.cs
index a8533900c7..24d9f9d07e 100644
--- a/src/System.Data.Common/src/System/Data/Common/DbProviderSpecificTypePropertyAttribute.cs
+++ b/src/System.Data.Common/src/System/Data/Common/DbProviderSpecificTypePropertyAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Data.Common
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class DbProviderSpecificTypePropertyAttribute : System.Attribute
{
diff --git a/src/System.Data.Common/src/System/Data/DBConcurrencyException.cs b/src/System.Data.Common/src/System/Data/DBConcurrencyException.cs
index 6550eb09cb..f250b21e3d 100644
--- a/src/System.Data.Common/src/System/Data/DBConcurrencyException.cs
+++ b/src/System.Data.Common/src/System/Data/DBConcurrencyException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Data
{
+ [Serializable]
public sealed class DBConcurrencyException : SystemException
{
private DataRow[] _dataRows;
diff --git a/src/System.Data.Common/src/System/Data/DataException.cs b/src/System.Data.Common/src/System/Data/DataException.cs
index 244e67a990..95060a4823 100644
--- a/src/System.Data.Common/src/System/Data/DataException.cs
+++ b/src/System.Data.Common/src/System/Data/DataException.cs
@@ -9,6 +9,7 @@ using System.Runtime.Serialization;
namespace System.Data
{
+ [Serializable]
public class DataException : SystemException
{
protected DataException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -29,6 +30,7 @@ namespace System.Data
public DataException(string s, Exception innerException) : base(s, innerException) { }
};
+ [Serializable]
public class ConstraintException : DataException
{
protected ConstraintException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -52,6 +54,7 @@ namespace System.Data
}
}
+ [Serializable]
public class DeletedRowInaccessibleException : DataException
{
protected DeletedRowInaccessibleException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -81,6 +84,7 @@ namespace System.Data
}
}
+ [Serializable]
public class DuplicateNameException : DataException
{
protected DuplicateNameException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -104,6 +108,7 @@ namespace System.Data
}
}
+ [Serializable]
public class InRowChangingEventException : DataException
{
protected InRowChangingEventException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -127,6 +132,7 @@ namespace System.Data
}
}
+ [Serializable]
public class InvalidConstraintException : DataException
{
protected InvalidConstraintException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -150,6 +156,7 @@ namespace System.Data
}
}
+ [Serializable]
public class MissingPrimaryKeyException : DataException
{
protected MissingPrimaryKeyException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -173,6 +180,7 @@ namespace System.Data
}
}
+ [Serializable]
public class NoNullAllowedException : DataException
{
protected NoNullAllowedException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -196,6 +204,7 @@ namespace System.Data
}
}
+ [Serializable]
public class ReadOnlyException : DataException
{
protected ReadOnlyException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -219,6 +228,7 @@ namespace System.Data
}
}
+ [Serializable]
public class RowNotInTableException : DataException
{
protected RowNotInTableException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -242,6 +252,7 @@ namespace System.Data
}
}
+ [Serializable]
public class VersionNotFoundException : DataException
{
protected VersionNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/System.Data.Common/src/System/Data/Filter/FilterException.cs b/src/System.Data.Common/src/System/Data/Filter/FilterException.cs
index a24a4f8fad..9a22d427d3 100644
--- a/src/System.Data.Common/src/System/Data/Filter/FilterException.cs
+++ b/src/System.Data.Common/src/System/Data/Filter/FilterException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Data
{
+ [Serializable]
public class InvalidExpressionException : DataException
{
protected InvalidExpressionException(SerializationInfo info, StreamingContext context)
@@ -22,6 +23,7 @@ namespace System.Data
public InvalidExpressionException(string message, Exception innerException) : base(message, innerException) { }
}
+ [Serializable]
public class EvaluateException : InvalidExpressionException
{
protected EvaluateException(SerializationInfo info, StreamingContext context)
@@ -36,6 +38,7 @@ namespace System.Data
public EvaluateException(string message, Exception innerException) : base(message, innerException) { }
}
+ [Serializable]
public class SyntaxErrorException : InvalidExpressionException
{
protected SyntaxErrorException(SerializationInfo info, StreamingContext context)
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs
index e574661272..eb0c997a56 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLBinary.cs
@@ -11,6 +11,7 @@ using System.Xml.Serialization;
namespace System.Data.SqlTypes
{
+ [Serializable]
[XmlSchemaProvider("GetXsdType")]
public struct SqlBinary : INullable, IComparable, IXmlSerializable
{
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
index 235c0691a0..baa92ecd7c 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
@@ -21,6 +21,7 @@ namespace System.Data.SqlTypes
Stream = 3,
}
+ [Serializable]
[XmlSchemaProvider("GetXsdType")]
public sealed class SqlBytes : INullable, IXmlSerializable, ISerializable
{
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs
index 7c7c25f7d8..761ad6480b 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs
@@ -13,7 +13,7 @@ using System.Runtime.CompilerServices;
namespace System.Data.SqlTypes
{
- [XmlSchemaProvider("GetXsdType")]
+ [Serializable, XmlSchemaProvider("GetXsdType")]
public sealed class SqlChars : INullable, IXmlSerializable, ISerializable
{
// --------------------------------------------------------------
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs
index 62db1e20de..5fbbd3ad87 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs
@@ -16,6 +16,7 @@ namespace System.Data.SqlTypes
/// Represents a fixed precision and scale numeric value between -10
/// -1 and 10 -1 to be stored in or retrieved from a database.
///
+ [Serializable]
[StructLayout(LayoutKind.Sequential)]
[XmlSchemaProvider("GetXsdType")]
public struct SqlDecimal : INullable, IComparable, IXmlSerializable
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs
index fc85e1ca8f..e8955966fb 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLMoney.cs
@@ -19,6 +19,7 @@ namespace System.Data.SqlTypes
/// a ten-thousandth of currency unit to be stored in or retrieved from a
/// database.
///
+ [Serializable]
[StructLayout(LayoutKind.Sequential)]
[XmlSchemaProvider("GetXsdType")]
public struct SqlMoney : INullable, IComparable, IXmlSerializable
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs
index ad40ff86c7..643ff22407 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLSingle.cs
@@ -16,6 +16,7 @@ namespace System.Data.SqlTypes
/// 3.40E +38 to be stored in or retrieved from a database.
///
[StructLayout(LayoutKind.Sequential)]
+ [Serializable]
[XmlSchemaProvider("GetXsdType")]
public struct SqlSingle : INullable, IComparable, IXmlSerializable
{
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SQLUtility.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SQLUtility.cs
index 7117157c97..f74bdeb5a6 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SQLUtility.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SQLUtility.cs
@@ -24,6 +24,7 @@ namespace System.Data.SqlTypes
UnmanagedBuffer = 2
}
+ [Serializable]
public class SqlTypeException : SystemException
{
public SqlTypeException() : this(SR.SqlMisc_SqlTypeMessage, null)
@@ -59,6 +60,7 @@ namespace System.Data.SqlTypes
}
} // SqlTypeException
+ [Serializable]
public sealed class SqlNullValueException : SqlTypeException
{
// Creates a new SqlNullValueException with its message string set to the common string.
@@ -88,6 +90,7 @@ namespace System.Data.SqlTypes
}
} // NullValueException
+ [Serializable]
public sealed class SqlTruncateException : SqlTypeException
{
// Creates a new SqlTruncateException with its message string set to the empty string.
@@ -117,6 +120,7 @@ namespace System.Data.SqlTypes
}
} // SqlTruncateException
+ [Serializable]
public sealed class SqlNotFilledException : SqlTypeException
{
// Creates a new SqlNotFilledException with its message string set to the common string.
@@ -135,6 +139,7 @@ namespace System.Data.SqlTypes
}
} // SqlNotFilledException
+ [Serializable]
public sealed class SqlAlreadyFilledException : SqlTypeException
{
// Creates a new SqlNotFilledException with its message string set to the common string.
diff --git a/src/System.Data.Common/src/System/Data/SQLTypes/SqlXml.cs b/src/System.Data.Common/src/System/Data/SQLTypes/SqlXml.cs
index 5e0d8b2f3e..8a9b90508b 100644
--- a/src/System.Data.Common/src/System/Data/SQLTypes/SqlXml.cs
+++ b/src/System.Data.Common/src/System/Data/SQLTypes/SqlXml.cs
@@ -13,7 +13,7 @@ using System.Reflection;
namespace System.Data.SqlTypes
{
- [XmlSchemaProvider("GetXsdType")]
+ [Serializable, XmlSchemaProvider("GetXsdType")]
public sealed class SqlXml : INullable, IXmlSerializable
{
private static readonly Func s_sqlReaderDelegate = CreateSqlReaderDelegate();
diff --git a/src/System.Data.Common/src/System/Data/SimpleType.cs b/src/System.Data.Common/src/System/Data/SimpleType.cs
index 9a1e8134e9..413cd22105 100644
--- a/src/System.Data.Common/src/System/Data/SimpleType.cs
+++ b/src/System.Data.Common/src/System/Data/SimpleType.cs
@@ -11,6 +11,7 @@ using System.Data.Common;
namespace System.Data
{
+ [Serializable]
internal sealed class SimpleType : ISerializable
{
private string _baseType = null; // base type name
diff --git a/src/System.Data.Common/src/System/Data/StrongTypingException.cs b/src/System.Data.Common/src/System/Data/StrongTypingException.cs
index 6ac93109cb..be2c317408 100644
--- a/src/System.Data.Common/src/System/Data/StrongTypingException.cs
+++ b/src/System.Data.Common/src/System/Data/StrongTypingException.cs
@@ -9,6 +9,7 @@ namespace System.Data
///
/// DEV: The exception that is throwing from strong typed DataSet when user access to DBNull value.
///
+ [Serializable]
public class StrongTypingException : DataException
{
protected StrongTypingException(SerializationInfo info, StreamingContext context)
diff --git a/src/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs b/src/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs
index a7f8bfea22..ded1409aea 100644
--- a/src/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs
+++ b/src/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs
@@ -10,6 +10,7 @@ using System.Text;
namespace System.Data.Common
{
+ [Serializable] // MDAC 83147
internal sealed class DBConnectionString
{
// instances of this class are intended to be immutable, i.e readonly
diff --git a/src/System.Data.Odbc/src/Common/System/Data/Common/NameValuePermission.cs b/src/System.Data.Odbc/src/Common/System/Data/Common/NameValuePermission.cs
index 92b74f7d8f..697961b4bc 100644
--- a/src/System.Data.Odbc/src/Common/System/Data/Common/NameValuePermission.cs
+++ b/src/System.Data.Odbc/src/Common/System/Data/Common/NameValuePermission.cs
@@ -7,6 +7,7 @@ using System.Diagnostics;
namespace System.Data.Common
{
+ [Serializable] // MDAC 83147
internal sealed class NameValuePermission : IComparable
{
// reused as both key and value nodes
diff --git a/src/System.Data.Odbc/src/Common/System/Data/Common/ReadOnlyCollection.cs b/src/System.Data.Odbc/src/Common/System/Data/Common/ReadOnlyCollection.cs
index eff21ac186..2bd0c8ad55 100644
--- a/src/System.Data.Odbc/src/Common/System/Data/Common/ReadOnlyCollection.cs
+++ b/src/System.Data.Odbc/src/Common/System/Data/Common/ReadOnlyCollection.cs
@@ -7,6 +7,7 @@ using System.Diagnostics;
namespace System.Data.Common
{
+ [Serializable()]
internal sealed class ReadOnlyCollection : System.Collections.ICollection, ICollection
{
private T[] _items;
@@ -83,6 +84,7 @@ namespace System.Data.Common
get { return _items.Length; }
}
+ [Serializable()]
internal struct Enumerator : IEnumerator, System.Collections.IEnumerator
{ // based on List.Enumerator
private K[] _items;
diff --git a/src/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPoolIdentity.cs b/src/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
index c2f427d5c6..eca8884385 100644
--- a/src/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
+++ b/src/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
@@ -4,6 +4,7 @@
namespace System.Data.ProviderBase
{
+ [Serializable]
internal sealed partial class DbConnectionPoolIdentity
{
public static readonly DbConnectionPoolIdentity NoIdentity = new DbConnectionPoolIdentity(String.Empty, false, true);
diff --git a/src/System.Data.Odbc/src/System/Data/Odbc/OdbcError.cs b/src/System.Data.Odbc/src/System/Data/Odbc/OdbcError.cs
index e472669b42..bf7508d23b 100644
--- a/src/System.Data.Odbc/src/System/Data/Odbc/OdbcError.cs
+++ b/src/System.Data.Odbc/src/System/Data/Odbc/OdbcError.cs
@@ -4,6 +4,7 @@
namespace System.Data.Odbc
{
+ [Serializable]
public sealed class OdbcError
{
//Data
diff --git a/src/System.Data.Odbc/src/System/Data/Odbc/OdbcErrorCollection.cs b/src/System.Data.Odbc/src/System/Data/Odbc/OdbcErrorCollection.cs
index dd701c2251..e6fa0ad5ba 100644
--- a/src/System.Data.Odbc/src/System/Data/Odbc/OdbcErrorCollection.cs
+++ b/src/System.Data.Odbc/src/System/Data/Odbc/OdbcErrorCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Data.Odbc
{
+ [Serializable]
public sealed class OdbcErrorCollection : ICollection
{
private ArrayList _items = new ArrayList();
diff --git a/src/System.Data.Odbc/src/System/Data/Odbc/OdbcException.cs b/src/System.Data.Odbc/src/System/Data/Odbc/OdbcException.cs
index e5540f009e..724ab8068d 100644
--- a/src/System.Data.Odbc/src/System/Data/Odbc/OdbcException.cs
+++ b/src/System.Data.Odbc/src/System/Data/Odbc/OdbcException.cs
@@ -8,6 +8,7 @@ using System.Text;
namespace System.Data.Odbc
{
+ [Serializable]
public sealed class OdbcException : System.Data.Common.DbException
{
private OdbcErrorCollection _odbcErrors = new OdbcErrorCollection();
diff --git a/src/System.Data.SqlClient/src/System/Data/OperationAbortedException.cs b/src/System.Data.SqlClient/src/System/Data/OperationAbortedException.cs
index 2a24138405..86e3832c17 100644
--- a/src/System.Data.SqlClient/src/System/Data/OperationAbortedException.cs
+++ b/src/System.Data.SqlClient/src/System/Data/OperationAbortedException.cs
@@ -5,6 +5,7 @@ using System.Runtime.Serialization;
namespace System.Data
{
+ [Serializable]
public sealed class OperationAbortedException : SystemException
{
private OperationAbortedException(string message, Exception innerException) : base(message, innerException)
diff --git a/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs b/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
index 9ee7e7f295..1134619a88 100644
--- a/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
+++ b/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
@@ -10,6 +10,7 @@ using System.Security.Principal;
namespace System.Data.ProviderBase
{
+ [Serializable]
sealed internal partial class DbConnectionPoolIdentity
{
public static readonly DbConnectionPoolIdentity NoIdentity = new DbConnectionPoolIdentity(String.Empty, false, true);
diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlError.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlError.cs
index ba4b0d5919..7535d4cfec 100644
--- a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlError.cs
+++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlError.cs
@@ -9,6 +9,7 @@
namespace System.Data.SqlClient
{
+ [Serializable]
public sealed class SqlError
{
private string _source = TdsEnums.SQL_PROVIDER_NAME;
diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlErrorCollection.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlErrorCollection.cs
index 8a06a7382f..f4c2d8fc65 100644
--- a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlErrorCollection.cs
+++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlErrorCollection.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
namespace System.Data.SqlClient
{
+ [Serializable]
public sealed class SqlErrorCollection : ICollection
{
// Ideally this would be typed as List, but that would make the non-generic
diff --git a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlException.cs b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlException.cs
index bcd7063847..442f220da6 100644
--- a/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlException.cs
+++ b/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlException.cs
@@ -16,6 +16,7 @@ using System.Text; // StringBuilder
namespace System.Data.SqlClient
{
+ [Serializable]
public sealed class SqlException : System.Data.Common.DbException
{
private const string OriginalClientConnectionIdKey = "OriginalClientConnectionId";
diff --git a/src/System.Diagnostics.Debug/src/System/Diagnostics/DebuggerStepperBoundaryAttribute.cs b/src/System.Diagnostics.Debug/src/System/Diagnostics/DebuggerStepperBoundaryAttribute.cs
index 36cb061552..521e0c5cab 100644
--- a/src/System.Diagnostics.Debug/src/System/Diagnostics/DebuggerStepperBoundaryAttribute.cs
+++ b/src/System.Diagnostics.Debug/src/System/Diagnostics/DebuggerStepperBoundaryAttribute.cs
@@ -8,6 +8,7 @@ namespace System.Diagnostics
{
/// Indicates the code following the attribute is to be executed in run, not step, mode.
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
+ [Serializable]
public sealed class DebuggerStepperBoundaryAttribute : Attribute
{
}
diff --git a/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs b/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
index d303b14274..b8b2bd24d8 100644
--- a/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
+++ b/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.Current.net45.cs
@@ -7,6 +7,7 @@ using System.Security;
namespace System.Diagnostics
{
+ [Serializable]
public partial class Activity
{
///
@@ -34,6 +35,7 @@ namespace System.Diagnostics
#region private
+ [Serializable]
private partial class KeyValueListNode
{
}
diff --git a/src/System.Diagnostics.Process/src/System/Collections/Specialized/DictionaryWrapper.cs b/src/System.Diagnostics.Process/src/System/Collections/Specialized/DictionaryWrapper.cs
index 51616e10a6..be0bed78d7 100644
--- a/src/System.Diagnostics.Process/src/System/Collections/Specialized/DictionaryWrapper.cs
+++ b/src/System.Diagnostics.Process/src/System/Collections/Specialized/DictionaryWrapper.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
namespace System.Collections.Specialized
{
+ [Serializable]
internal sealed class DictionaryWrapper : IDictionary, IDictionary
{
private readonly Dictionary _contents;
diff --git a/src/System.Diagnostics.Process/src/System/Collections/Specialized/StringDictionaryWrapper.cs b/src/System.Diagnostics.Process/src/System/Collections/Specialized/StringDictionaryWrapper.cs
index a032be811c..e89dcdf931 100644
--- a/src/System.Diagnostics.Process/src/System/Collections/Specialized/StringDictionaryWrapper.cs
+++ b/src/System.Diagnostics.Process/src/System/Collections/Specialized/StringDictionaryWrapper.cs
@@ -9,6 +9,7 @@ namespace System.Collections.Specialized
// This class is an internal class used by System.Diagnostics.Proccess on property EnvironmentVariables which returns an StringDictionary. Since we need
// EnvironmentVariables to return a StringDictionary, this is a wrapper to the Environment property in order to get the same comparer behavior on both properties.
+ [Serializable]
internal sealed class StringDictionaryWrapper : StringDictionary
{
private readonly DictionaryWrapper _contents;
diff --git a/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/exceptions.cs b/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/exceptions.cs
index b6d6ec97ca..81132e1753 100644
--- a/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/exceptions.cs
+++ b/src/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/exceptions.cs
@@ -12,6 +12,7 @@ using System.Security.Permissions;
namespace System.DirectoryServices.AccountManagement
{
+ [Serializable()]
abstract public class PrincipalException : SystemException
{
internal PrincipalException() : base() { }
@@ -29,6 +30,7 @@ namespace System.DirectoryServices.AccountManagement
}
}
+ [Serializable()]
public class MultipleMatchesException : PrincipalException
{
public MultipleMatchesException() : base() { }
@@ -46,6 +48,7 @@ namespace System.DirectoryServices.AccountManagement
}
}
+ [Serializable()]
public class NoMatchingPrincipalException : PrincipalException
{
public NoMatchingPrincipalException() : base() { }
@@ -63,6 +66,7 @@ namespace System.DirectoryServices.AccountManagement
}
}
+ [Serializable()]
public class PasswordException : PrincipalException
{
public PasswordException() : base() { }
@@ -80,6 +84,7 @@ namespace System.DirectoryServices.AccountManagement
}
}
+ [Serializable()]
public class PrincipalExistsException : PrincipalException
{
public PrincipalExistsException() : base() { }
@@ -97,6 +102,7 @@ namespace System.DirectoryServices.AccountManagement
}
}
+ [Serializable()]
public class PrincipalServerDownException : PrincipalException
{
private int _errorCode = 0;
@@ -136,6 +142,7 @@ namespace System.DirectoryServices.AccountManagement
}
}
+ [Serializable()]
public class PrincipalOperationException : PrincipalException
{
private int _errorCode = 0;
diff --git a/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryException.cs b/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryException.cs
index 38c9f0906f..0461d7623d 100644
--- a/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryException.cs
+++ b/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryException.cs
@@ -8,6 +8,7 @@ namespace System.DirectoryServices.Protocols
using System.Runtime.Serialization;
using System.Security.Permissions;
+ [Serializable]
public class DirectoryException : Exception
{
protected DirectoryException(SerializationInfo info, StreamingContext context) : base(info, context)
@@ -28,6 +29,7 @@ namespace System.DirectoryServices.Protocols
}
}
+ [Serializable]
public class DirectoryOperationException : DirectoryException, ISerializable
{
internal DirectoryResponse response = null;
@@ -71,6 +73,7 @@ namespace System.DirectoryServices.Protocols
}
}
+ [Serializable]
public class BerConversionException : DirectoryException
{
protected BerConversionException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapException.cs b/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapException.cs
index 37cd96279d..70111bdbf5 100644
--- a/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapException.cs
+++ b/src/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapException.cs
@@ -73,6 +73,7 @@ namespace System.DirectoryServices.Protocols
}
}
+ [Serializable]
public class LdapException : DirectoryException, ISerializable
{
private int _errorCode;
@@ -140,6 +141,7 @@ namespace System.DirectoryServices.Protocols
}
}
+ [Serializable]
public class TlsOperationException : DirectoryOperationException
{
protected TlsOperationException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Exception.cs b/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Exception.cs
index fbe71c90bf..7e5d64c9df 100644
--- a/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Exception.cs
+++ b/src/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Exception.cs
@@ -75,6 +75,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
}
+ [Serializable]
public class ActiveDirectoryObjectNotFoundException : Exception, ISerializable
{
private Type _objectType;
@@ -120,6 +121,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
}
+ [Serializable]
public class ActiveDirectoryOperationException : Exception, ISerializable
{
private int _errorCode = 0;
@@ -159,6 +161,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
}
+ [Serializable]
public class ActiveDirectoryServerDownException : Exception, ISerializable
{
private int _errorCode = 0;
@@ -222,6 +225,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
}
+ [Serializable]
public class ActiveDirectoryObjectExistsException : Exception
{
public ActiveDirectoryObjectExistsException(string message, Exception inner) : base(message, inner) { }
@@ -236,6 +240,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
}
+ [Serializable]
public class SyncFromAllServersOperationException : ActiveDirectoryOperationException, ISerializable
{
private SyncFromAllServersErrorInformation[] _errors = null;
@@ -277,6 +282,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
}
+ [Serializable]
public class ForestTrustCollisionException : ActiveDirectoryOperationException, ISerializable
{
private ForestTrustRelationshipCollisionCollection _collisions = new ForestTrustRelationshipCollisionCollection();
diff --git a/src/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs b/src/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs
index aab6826907..44df63eb99 100644
--- a/src/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs
+++ b/src/System.DirectoryServices/src/System/DirectoryServices/DirectoryServicesCOMException.cs
@@ -12,6 +12,7 @@ namespace System.DirectoryServices
using System.Security.Permissions;
using System.Globalization;
+ [Serializable]
public class DirectoryServicesCOMException : COMException, ISerializable
{
private int _extendederror = 0;
diff --git a/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs b/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs
index 17ce78ac7c..e28d6de3f0 100644
--- a/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs
+++ b/src/System.Drawing.Primitives/ref/System.Drawing.Primitives.cs
@@ -7,6 +7,7 @@
namespace System.Drawing
{
+ [System.SerializableAttribute]
public partial struct Color : System.IEquatable
{
public static readonly System.Drawing.Color Empty;
diff --git a/src/System.Globalization.Extensions/src/System/Globalization/Extensions.cs b/src/System.Globalization.Extensions/src/System/Globalization/Extensions.cs
index ed820ed03e..74717cbd33 100644
--- a/src/System.Globalization.Extensions/src/System/Globalization/Extensions.cs
+++ b/src/System.Globalization.Extensions/src/System/Globalization/Extensions.cs
@@ -36,6 +36,7 @@ namespace System.Globalization
}
}
+ [Serializable]
internal sealed class CultureAwareComparer : StringComparer
{
internal const CompareOptions ValidCompareMaskOffFlags =
diff --git a/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs b/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs
index 1c55355154..3067ee58e4 100644
--- a/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs
+++ b/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.IO.Compression
{
+ [Serializable]
internal partial class ZLibException : IOException, ISerializable
{
///
diff --git a/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.cs b/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.cs
index a1d17d9ad6..34aedfb26c 100644
--- a/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.cs
+++ b/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.IO
{
+ [Serializable]
public sealed partial class DriveInfo : ISerializable
{
private readonly string _name;
diff --git a/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveNotFoundException.cs b/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveNotFoundException.cs
index 4a47fd8e71..54cd480f84 100644
--- a/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveNotFoundException.cs
+++ b/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveNotFoundException.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.IO
{
//Thrown when trying to access a drive that is not available.
+ [Serializable]
public class DriveNotFoundException : IOException
{
public DriveNotFoundException()
diff --git a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs
index 1e1e4247d0..b33b529686 100644
--- a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs
+++ b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs
@@ -51,6 +51,7 @@ namespace System.IO
protected override void Dispose(bool disposing) { }
public void EndInit() { }
}
+ [Serializable]
public partial class InternalBufferOverflowException : System.SystemException
{
public InternalBufferOverflowException() { }
diff --git a/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs b/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs
index b0b0100289..3b7985070e 100644
--- a/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs
+++ b/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs
@@ -9,6 +9,7 @@ namespace System.IO
///
/// The exception that is thrown when the internal buffer overflows.
///
+ [Serializable]
public class InternalBufferOverflowException : SystemException
{
///
diff --git a/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs b/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs
index 0cadf4d03a..9f1c014c0b 100644
--- a/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs
+++ b/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs
@@ -36,5 +36,11 @@ namespace System.IO.Tests
Assert.Equal(message, ide.Message);
Assert.Same(innerException, ide.InnerException);
}
+
+ [Fact]
+ public static void ExceptionRoundtrips()
+ {
+ BinaryFormatterHelpers.AssertRoundtrips(new InternalBufferOverflowException());
+ }
}
}
diff --git a/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs b/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
index 03c7311565..4b4a274997 100644
--- a/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
+++ b/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
@@ -10,6 +10,7 @@ using System.Runtime.Serialization;
namespace System.IO
{
+ [Serializable]
public sealed partial class DirectoryInfo : FileSystemInfo
{
[System.Security.SecuritySafeCritical]
diff --git a/src/System.IO.FileSystem/src/System/IO/FileInfo.cs b/src/System.IO.FileSystem/src/System/IO/FileInfo.cs
index 8ff606c857..e13fcfe9f5 100644
--- a/src/System.IO.FileSystem/src/System/IO/FileInfo.cs
+++ b/src/System.IO.FileSystem/src/System/IO/FileInfo.cs
@@ -15,6 +15,7 @@ namespace System.IO
{
// Class for creating FileStream objects, and some basic file management
// routines such as Delete, etc.
+ [Serializable]
public sealed partial class FileInfo : FileSystemInfo
{
private String _name;
diff --git a/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs b/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs
index 31a8432b74..5002a4c828 100644
--- a/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs
+++ b/src/System.IO.FileSystem/src/System/IO/FileSystemInfo.cs
@@ -13,6 +13,7 @@ using System.Runtime.Versioning;
namespace System.IO
{
+ [Serializable]
public abstract partial class FileSystemInfo : MarshalByRefObject, ISerializable
{
protected String FullPath; // fully qualified path of the file or directory
diff --git a/src/System.IO.FileSystem/tests/DirectoryInfo/Serialization.cs b/src/System.IO.FileSystem/tests/DirectoryInfo/Serialization.cs
new file mode 100644
index 0000000000..0395821da3
--- /dev/null
+++ b/src/System.IO.FileSystem/tests/DirectoryInfo/Serialization.cs
@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization.Formatters.Tests;
+using Xunit;
+
+namespace System.IO.Tests
+{
+ public partial class DirectoryInfo_Serialization : FileSystemTest
+ {
+ [Fact]
+ public void SerializeDeserialize_Roundtrip()
+ {
+ var orig = new DirectoryInfo("SomePath");
+ DirectoryInfo cloned = BinaryFormatterHelpers.Clone(orig);
+ Assert.Equal(orig.Name, cloned.Name);
+ Assert.Equal(orig.FullName, cloned.FullName);
+ Assert.Equal(orig.ToString(), cloned.ToString());
+ }
+ }
+}
diff --git a/src/System.IO.FileSystem/tests/FileInfo/Serialization.cs b/src/System.IO.FileSystem/tests/FileInfo/Serialization.cs
new file mode 100644
index 0000000000..275c88ddcd
--- /dev/null
+++ b/src/System.IO.FileSystem/tests/FileInfo/Serialization.cs
@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization.Formatters.Tests;
+using Xunit;
+
+namespace System.IO.Tests
+{
+ public class FileInfo_Serialization : FileSystemTest
+ {
+ [Fact]
+ public void SerializeDeserialize_Roundtrip()
+ {
+ var orig = new DirectoryInfo("SomePath");
+ DirectoryInfo cloned = BinaryFormatterHelpers.Clone(orig);
+ Assert.Equal(orig.Name, cloned.Name);
+ Assert.Equal(orig.FullName, cloned.FullName);
+ Assert.Equal(orig.ToString(), cloned.ToString());
+ }
+ }
+}
diff --git a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
index 02cbadaf0d..7e346d3068 100644
--- a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
+++ b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
@@ -18,6 +18,7 @@
+
diff --git a/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs b/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs
index c0058083c8..c1451074cd 100644
--- a/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs
+++ b/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.IO.IsolatedStorage
{
+ [Serializable]
public partial class IsolatedStorageException : Exception
{
protected IsolatedStorageException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/System.Linq.Expressions/src/System/Dynamic/DynamicObject.cs b/src/System.Linq.Expressions/src/System/Dynamic/DynamicObject.cs
index d7ffc87300..5e807ec9c4 100644
--- a/src/System.Linq.Expressions/src/System/Dynamic/DynamicObject.cs
+++ b/src/System.Linq.Expressions/src/System/Dynamic/DynamicObject.cs
@@ -23,6 +23,7 @@ namespace System.Dynamic
/// If a method is not overridden then the does not directly support
/// that behavior and the call site will determine how the binding should be performed.
///
+ [Serializable]
public class DynamicObject : IDynamicMetaObjectProvider
{
///
diff --git a/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/ReadOnlyCollectionBuilder.cs b/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/ReadOnlyCollectionBuilder.cs
index b243575f7b..d7a353b079 100644
--- a/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/ReadOnlyCollectionBuilder.cs
+++ b/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/ReadOnlyCollectionBuilder.cs
@@ -13,6 +13,7 @@ namespace System.Runtime.CompilerServices
/// Builder for read only collections.
///
/// The type of the collection element.
+ [Serializable]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public sealed class ReadOnlyCollectionBuilder : IList, IList
{
@@ -491,6 +492,7 @@ namespace System.Runtime.CompilerServices
}
}
+ [Serializable]
private class Enumerator : IEnumerator, IEnumerator
{
private readonly ReadOnlyCollectionBuilder _builder;
diff --git a/src/System.Net.Http/src/System/Net/Http/HttpRequestException.cs b/src/System.Net.Http/src/System/Net/Http/HttpRequestException.cs
index a24a0d4097..699afc9eec 100644
--- a/src/System.Net.Http/src/System/Net/Http/HttpRequestException.cs
+++ b/src/System.Net.Http/src/System/Net/Http/HttpRequestException.cs
@@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis;
namespace System.Net.Http
{
+ [Serializable]
[SuppressMessage("Microsoft.Serialization", "CA2229")]
public class HttpRequestException : Exception
{
diff --git a/src/System.Net.HttpListener/src/System/Net/HttpListenerException.cs b/src/System.Net.HttpListener/src/System/Net/HttpListenerException.cs
index d0b5af1375..e9a96691d5 100644
--- a/src/System.Net.HttpListener/src/System/Net/HttpListenerException.cs
+++ b/src/System.Net.HttpListener/src/System/Net/HttpListenerException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Net
{
+ [Serializable]
public class HttpListenerException : Win32Exception
{
public HttpListenerException() : base(Marshal.GetLastWin32Error())
diff --git a/src/System.Net.Mail/src/System/Net/Mail/SmtpException.cs b/src/System.Net.Mail/src/System/Net/Mail/SmtpException.cs
index 1b6aa7231e..c30e50192f 100644
--- a/src/System.Net.Mail/src/System/Net/Mail/SmtpException.cs
+++ b/src/System.Net.Mail/src/System/Net/Mail/SmtpException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Net.Mail
{
+ [Serializable]
public class SmtpException : Exception, ISerializable
{
private SmtpStatusCode _statusCode = SmtpStatusCode.GeneralFailure;
diff --git a/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientException.cs b/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientException.cs
index 3b9813d91a..7551e36d4c 100644
--- a/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientException.cs
+++ b/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Net.Mail
{
+ [Serializable]
public class SmtpFailedRecipientException : SmtpException, ISerializable
{
private string _failedRecipient;
diff --git a/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientsException.cs b/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientsException.cs
index 9d1de650f7..6aa1ac6141 100644
--- a/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientsException.cs
+++ b/src/System.Net.Mail/src/System/Net/Mail/SmtpFailedRecipientsException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Net.Mail
{
+ [Serializable]
public class SmtpFailedRecipientsException : SmtpFailedRecipientException, ISerializable
{
private SmtpFailedRecipientException[] _innerExceptions;
diff --git a/src/System.Net.Ping/src/System/Net/NetworkInformation/PingException.cs b/src/System.Net.Ping/src/System/Net/NetworkInformation/PingException.cs
index ee56c2e996..7af8f88f30 100644
--- a/src/System.Net.Ping/src/System/Net/NetworkInformation/PingException.cs
+++ b/src/System.Net.Ping/src/System/Net/NetworkInformation/PingException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Net.NetworkInformation
{
+ [Serializable]
public class PingException : InvalidOperationException
{
public PingException(string message) :
diff --git a/src/System.Net.Primitives/src/System/Net/CookieContainer.cs b/src/System.Net.Primitives/src/System/Net/CookieContainer.cs
index 4467c8c81b..f2ef66ebbc 100644
--- a/src/System.Net.Primitives/src/System/Net/CookieContainer.cs
+++ b/src/System.Net.Primitives/src/System/Net/CookieContainer.cs
@@ -981,6 +981,7 @@ namespace System.Net
}
}
+ [Serializable]
internal struct PathList
{
// Usage of PathList depends on it being shallowly immutable;
@@ -1058,6 +1059,7 @@ namespace System.Net
}
}
+ [Serializable]
private sealed class PathListComparer : IComparer
{
internal static readonly PathListComparer StaticInstance = new PathListComparer();
diff --git a/src/System.Net.Primitives/src/System/Net/CookieException.cs b/src/System.Net.Primitives/src/System/Net/CookieException.cs
index d2c6870e96..b21e7223a2 100644
--- a/src/System.Net.Primitives/src/System/Net/CookieException.cs
+++ b/src/System.Net.Primitives/src/System/Net/CookieException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Net
{
+ [Serializable]
public class CookieException : FormatException, ISerializable
{
public CookieException() : base()
diff --git a/src/System.Net.Primitives/src/System/Net/EndPoint.cs b/src/System.Net.Primitives/src/System/Net/EndPoint.cs
index 96b616478d..8585ab4444 100644
--- a/src/System.Net.Primitives/src/System/Net/EndPoint.cs
+++ b/src/System.Net.Primitives/src/System/Net/EndPoint.cs
@@ -13,6 +13,7 @@ namespace System.Net
/// Identifies a network address.
///
///
+ [Serializable]
public abstract class EndPoint
{
///
diff --git a/src/System.Net.Primitives/src/System/Net/IPAddress.cs b/src/System.Net.Primitives/src/System/Net/IPAddress.cs
index fbe0e4fdcb..5a1d5e3812 100644
--- a/src/System.Net.Primitives/src/System/Net/IPAddress.cs
+++ b/src/System.Net.Primitives/src/System/Net/IPAddress.cs
@@ -12,6 +12,7 @@ namespace System.Net
/// Provides an Internet Protocol (IP) address.
///
///
+ [Serializable]
public class IPAddress
{
public static readonly IPAddress Any = new IPAddress(0x0000000000000000);
diff --git a/src/System.Net.Primitives/src/System/Net/IPEndPoint.cs b/src/System.Net.Primitives/src/System/Net/IPEndPoint.cs
index b971a3a4e9..db8635632b 100644
--- a/src/System.Net.Primitives/src/System/Net/IPEndPoint.cs
+++ b/src/System.Net.Primitives/src/System/Net/IPEndPoint.cs
@@ -12,6 +12,7 @@ namespace System.Net
/// Provides an IP address.
///
///
+ [Serializable]
public class IPEndPoint : EndPoint
{
///
diff --git a/src/System.Net.Primitives/src/System/Net/SocketException.cs b/src/System.Net.Primitives/src/System/Net/SocketException.cs
index c2ad7246ae..9f7ec9e759 100644
--- a/src/System.Net.Primitives/src/System/Net/SocketException.cs
+++ b/src/System.Net.Primitives/src/System/Net/SocketException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Net.Sockets
{
/// Provides socket exceptions to the application.
+ [Serializable]
public partial class SocketException : Win32Exception
{
/// The SocketError or Int32 specified when constructing the exception.
diff --git a/src/System.Net.Primitives/tests/FunctionalTests/SerializationTest.cs b/src/System.Net.Primitives/tests/FunctionalTests/SerializationTest.cs
index 34ec4df8a0..5e662cc7c0 100644
--- a/src/System.Net.Primitives/tests/FunctionalTests/SerializationTest.cs
+++ b/src/System.Net.Primitives/tests/FunctionalTests/SerializationTest.cs
@@ -12,6 +12,8 @@ namespace System.Net.Primitives.Functional.Tests
{
public static IEnumerable
+ [Serializable]
public class HttpWebResponse : WebResponse, ISerializable
{
private HttpResponseMessage _httpResponseMessage;
diff --git a/src/System.Net.Requests/src/System/Net/ProtocolViolationException.cs b/src/System.Net.Requests/src/System/Net/ProtocolViolationException.cs
index d7833d2db6..4f3b7a6a0c 100644
--- a/src/System.Net.Requests/src/System/Net/ProtocolViolationException.cs
+++ b/src/System.Net.Requests/src/System/Net/ProtocolViolationException.cs
@@ -12,6 +12,7 @@ namespace System.Net
/// protocol.
///
///
+ [Serializable]
public class ProtocolViolationException : InvalidOperationException, ISerializable
{
///
diff --git a/src/System.Net.Requests/src/System/Net/WebException.cs b/src/System.Net.Requests/src/System/Net/WebException.cs
index 4342f45949..7496fb05b1 100644
--- a/src/System.Net.Requests/src/System/Net/WebException.cs
+++ b/src/System.Net.Requests/src/System/Net/WebException.cs
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
namespace System.Net
{
+ [Serializable]
public partial class WebException : InvalidOperationException, ISerializable
{
private const WebExceptionStatus DefaultStatus = WebExceptionStatus.UnknownError;
diff --git a/src/System.Net.Requests/src/System/Net/WebRequest.cs b/src/System.Net.Requests/src/System/Net/WebRequest.cs
index d739492ca8..cb7a0f3e52 100644
--- a/src/System.Net.Requests/src/System/Net/WebRequest.cs
+++ b/src/System.Net.Requests/src/System/Net/WebRequest.cs
@@ -13,6 +13,7 @@ using System.Threading;
using System.Threading.Tasks;
namespace System.Net
{
+ [Serializable]
public abstract class WebRequest : MarshalByRefObject, ISerializable
{
internal class WebRequestPrefixElement
diff --git a/src/System.Net.Requests/src/System/Net/WebResponse.cs b/src/System.Net.Requests/src/System/Net/WebResponse.cs
index e565db9933..48ae1cb48b 100644
--- a/src/System.Net.Requests/src/System/Net/WebResponse.cs
+++ b/src/System.Net.Requests/src/System/Net/WebResponse.cs
@@ -13,6 +13,7 @@ namespace System.Net
/// response from a Uniform Resource Identifier (Uri). This is an abstract class.
///
///
+ [Serializable]
public abstract class WebResponse : MarshalByRefObject, ISerializable, IDisposable
{
///
diff --git a/src/System.Net.Requests/tests/HttpWebRequestTest.cs b/src/System.Net.Requests/tests/HttpWebRequestTest.cs
index ce5576a804..3c8b8abfa6 100644
--- a/src/System.Net.Requests/tests/HttpWebRequestTest.cs
+++ b/src/System.Net.Requests/tests/HttpWebRequestTest.cs
@@ -1327,15 +1327,19 @@ namespace System.Net.Tests
BinaryFormatter formatter = new BinaryFormatter();
var hwr = HttpWebRequest.CreateHttp("http://localhost");
- // .NET Framework throws
- // System.Runtime.Serialization.SerializationException:
- // Type 'System.Net.WebRequest+WebProxyWrapper' in Assembly 'System, Version=4.0.0.
- // 0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
- // While .NET Core throws
- // System.Runtime.Serialization.SerializationException:
- // Type 'System.Net.HttpWebRequest' in Assembly 'System.Net.Requests, Version=4.0.0.
- // 0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
- Assert.Throws(() => formatter.Serialize(fs, hwr));
+ if (PlatformDetection.IsFullFramework)
+ {
+ // .NET Framework throws a more detailed exception.
+ // System.Runtime.Serialization.SerializationException):
+ // Type 'System.Net.WebRequest+WebProxyWrapper' in Assembly 'System, Version=4.0.0.
+ // 0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
+ Assert.Throws(() => formatter.Serialize(fs, hwr));
+ }
+ else
+ {
+ // TODO: Issue #18850. Change HttpWebRquest to throw SerializationException similar to .NET Framework.
+ Assert.Throws(() => formatter.Serialize(fs, hwr));
+ }
}
}
}
diff --git a/src/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs b/src/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs
index 7fdcebc4cb..67155869ed 100644
--- a/src/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs
+++ b/src/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs
@@ -10,7 +10,6 @@ using System.Runtime.Serialization.Formatters.Binary;
using Xunit;
using Xunit.Abstractions;
-using System.Runtime.Serialization;
namespace System.Net.Tests
{
@@ -142,7 +141,7 @@ namespace System.Net.Tests
else
{
// HttpWebResponse is not serializable on .NET Core.
- Assert.Throws(() => formatter.Serialize(fs, hwr));
+ Assert.Throws(() => formatter.Serialize(fs, hwr));
}
}
}
diff --git a/src/System.Net.Security/src/System/Security/Authentication/AuthenticationException.cs b/src/System.Net.Security/src/System/Security/Authentication/AuthenticationException.cs
index cd53d16c7e..845e5d7805 100644
--- a/src/System.Net.Security/src/System/Security/Authentication/AuthenticationException.cs
+++ b/src/System.Net.Security/src/System/Security/Authentication/AuthenticationException.cs
@@ -11,6 +11,7 @@ namespace System.Security.Authentication
/// The authentication process can be retried with different parameters subject to
/// remote party willingness of accepting that.
///
+ [Serializable]
public class AuthenticationException : SystemException
{
public AuthenticationException() { }
@@ -29,6 +30,7 @@ namespace System.Security.Authentication
/// underlined stream.
///
///
+ [Serializable]
public class InvalidCredentialException : AuthenticationException
{
public InvalidCredentialException() { }
diff --git a/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs b/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs
index e1c06da328..ea593cb7fb 100644
--- a/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs
+++ b/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs
@@ -13,6 +13,7 @@ namespace System.Security.Authentication.ExtendedProtection
/// This class contains the necessary settings for specifying how Extended Protection
/// should behave. Use one of the Build* methods to create an instance of this type.
///
+ [Serializable]
public class ExtendedProtectionPolicy : ISerializable
{
private const string policyEnforcementName = "policyEnforcement";
diff --git a/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs b/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs
index 3931389d73..a67d4d8935 100644
--- a/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs
+++ b/src/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs
@@ -10,6 +10,7 @@ using System.Net;
namespace System.Security.Authentication.ExtendedProtection
{
+ [Serializable]
public class ServiceNameCollection : ReadOnlyCollectionBase
{
public ServiceNameCollection(ICollection items)
diff --git a/src/System.Net.Sockets/src/System/Net/Sockets/SocketInformation.cs b/src/System.Net.Sockets/src/System/Net/Sockets/SocketInformation.cs
index 2f9e510a39..f8a183f731 100644
--- a/src/System.Net.Sockets/src/System/Net/Sockets/SocketInformation.cs
+++ b/src/System.Net.Sockets/src/System/Net/Sockets/SocketInformation.cs
@@ -4,6 +4,7 @@
namespace System.Net.Sockets
{
+ [Serializable]
public struct SocketInformation
{
public byte[] ProtocolInformation { get; set; }
diff --git a/src/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs b/src/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs
index 761a45e65e..e67747a493 100644
--- a/src/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs
+++ b/src/System.Net.WebHeaderCollection/src/System/Net/WebHeaderCollection.cs
@@ -27,6 +27,7 @@ namespace System.Net
FileWebResponse,
}
+ [Serializable]
public class WebHeaderCollection : NameValueCollection, ISerializable
{
private const int ApproxAveHeaderLineSize = 30;
diff --git a/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs b/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs
index 9dd3647f2e..fddda2fbe9 100644
--- a/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs
+++ b/src/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs
@@ -527,6 +527,7 @@ namespace System.Net.Tests
{
var headers = new WebHeaderCollection();
Assert.Throws(paramName, () => headers.Add(header));
+
}
[Fact]
diff --git a/src/System.Net.WebProxy/src/System/Net/WebProxy.cs b/src/System.Net.WebProxy/src/System/Net/WebProxy.cs
index b2bff48b75..098162896a 100644
--- a/src/System.Net.WebProxy/src/System/Net/WebProxy.cs
+++ b/src/System.Net.WebProxy/src/System/Net/WebProxy.cs
@@ -10,6 +10,7 @@ using System.Text.RegularExpressions;
namespace System.Net
{
+ [Serializable]
public class WebProxy : IWebProxy, ISerializable
{
private ArrayList _bypassList;
diff --git a/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs b/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs
index 9e79b5d217..eddeea2443 100644
--- a/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs
+++ b/src/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketException.cs
@@ -9,6 +9,7 @@ using System.Runtime.Serialization;
namespace System.Net.WebSockets
{
+ [Serializable]
public sealed class WebSocketException : Win32Exception
{
private readonly WebSocketError _webSocketErrorCode;
diff --git a/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs b/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs
index 67d1999bc1..91bccc06bd 100644
--- a/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs
+++ b/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs
@@ -350,6 +350,7 @@ namespace System.Collections.ObjectModel
#region Private Types
+ [Serializable]
private struct BlockReentrancyDisposable : IDisposable
{
private readonly ObservableCollection _collection;
diff --git a/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
index a62eaafe2f..5f20b400d4 100644
--- a/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
+++ b/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
@@ -354,6 +354,7 @@ namespace System.Collections.ObjectModel
}
}
+ [Serializable]
private struct DictionaryEnumerator : IDictionaryEnumerator
{
private readonly IDictionary _dictionary;
@@ -418,6 +419,7 @@ namespace System.Collections.ObjectModel
#endregion IReadOnlyDictionary members
+ [Serializable]
[DebuggerTypeProxy(typeof(CollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
public sealed class KeyCollection : ICollection, ICollection, IReadOnlyCollection
@@ -526,6 +528,7 @@ namespace System.Collections.ObjectModel
#endregion
}
+ [Serializable]
[DebuggerTypeProxy(typeof(CollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}")]
public sealed class ValueCollection : ICollection, ICollection, IReadOnlyCollection
diff --git a/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs b/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs
index 97e18aaea5..b862c9bbe3 100644
--- a/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs
+++ b/src/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionary_SerializationTests.cs
@@ -25,6 +25,16 @@ namespace System.Collections.ObjectModel.Tests
ReadOnlyDictionary clone = BinaryFormatterHelpers.Clone(d);
Assert.NotSame(d, clone);
Assert.Equal(d, clone);
+
+ ReadOnlyDictionary.KeyCollection keys = d.Keys;
+ ReadOnlyDictionary.KeyCollection keysClone = BinaryFormatterHelpers.Clone(keys);
+ Assert.NotSame(keys, keysClone);
+ Assert.Equal(keys, keysClone);
+
+ ReadOnlyDictionary.ValueCollection values = d.Values;
+ ReadOnlyDictionary.ValueCollection valuesClone = BinaryFormatterHelpers.Clone(values);
+ Assert.NotSame(values, valuesClone);
+ Assert.Equal(values, valuesClone);
}
}
}
diff --git a/src/System.Private.Uri/src/System/UriFormatException.cs b/src/System.Private.Uri/src/System/UriFormatException.cs
index c3789a0529..5f043cab86 100644
--- a/src/System.Private.Uri/src/System/UriFormatException.cs
+++ b/src/System.Private.Uri/src/System/UriFormatException.cs
@@ -9,6 +9,7 @@ namespace System
///
/// An exception class used when an invalid Uniform Resource Identifier is detected.
///
+ [Serializable]
public class UriFormatException : FormatException, ISerializable
{
public UriFormatException() : base()
diff --git a/src/System.Private.Xml.Linq/src/System/Xml/Linq/XName.cs b/src/System.Private.Xml.Linq/src/System/Xml/Linq/XName.cs
index efc95cbeb8..2dbdf6c6b8 100644
--- a/src/System.Private.Xml.Linq/src/System/Xml/Linq/XName.cs
+++ b/src/System.Private.Xml.Linq/src/System/Xml/Linq/XName.cs
@@ -10,6 +10,7 @@ namespace System.Xml.Linq
///
/// Represents a name of an XML element or attribute. This class cannot be inherited.
///
+ [Serializable]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Serialization", "CA2229", Justification = "Serialized with custom proxy")]
public sealed class XName : IEquatable, ISerializable
{
diff --git a/src/System.Private.Xml/src/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs b/src/System.Private.Xml/src/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs
index d16397a464..c1aaaa3ea8 100644
--- a/src/System.Private.Xml/src/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs
+++ b/src/System.Private.Xml/src/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs
@@ -12,6 +12,7 @@ namespace System.Xml.Schema
using System.Diagnostics;
using System.Globalization;
+ [Serializable]
public class XmlSchemaInferenceException : XmlSchemaException
{
protected XmlSchemaInferenceException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs b/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs
index 9c7bc09e59..7b734fa40c 100644
--- a/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs
+++ b/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaException.cs
@@ -13,6 +13,7 @@ namespace System.Xml.Schema
using System.Diagnostics;
///
+ [Serializable]
public class XmlSchemaException : SystemException
{
private string _res;
diff --git a/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidationException.cs b/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidationException.cs
index 73d84e25f2..91a5f43552 100644
--- a/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidationException.cs
+++ b/src/System.Private.Xml/src/System/Xml/Schema/XmlSchemaValidationException.cs
@@ -12,6 +12,7 @@ namespace System.Xml.Schema
using System.Diagnostics;
///
+ [Serializable]
public class XmlSchemaValidationException : XmlSchemaException
{
private Object _sourceNodeObject;
diff --git a/src/System.Private.Xml/src/System/Xml/XPath/XPathException.cs b/src/System.Private.Xml/src/System/Xml/XPath/XPathException.cs
index 241d4d2c06..26de320deb 100644
--- a/src/System.Private.Xml/src/System/Xml/XPath/XPathException.cs
+++ b/src/System.Private.Xml/src/System/Xml/XPath/XPathException.cs
@@ -11,6 +11,7 @@ namespace System.Xml.XPath
{
// Represents the exception that is thrown when there is error processing an
// XPath expression.
+ [Serializable]
public class XPathException : SystemException
{
// we need to keep this members for V1 serialization compatibility
diff --git a/src/System.Private.Xml/src/System/Xml/XmlException.cs b/src/System.Private.Xml/src/System/Xml/XmlException.cs
index 609a3c3fad..373c77ea6c 100644
--- a/src/System.Private.Xml/src/System/Xml/XmlException.cs
+++ b/src/System.Private.Xml/src/System/Xml/XmlException.cs
@@ -16,6 +16,7 @@ namespace System.Xml
/// Returns detailed information about the last parse error, including the error
/// number, line number, character position, and a text description.
///
+ [Serializable]
public class XmlException : SystemException
{
private string _res;
diff --git a/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs b/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs
index f98ddd30f8..e042aa8ed3 100644
--- a/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs
+++ b/src/System.Private.Xml/src/System/Xml/XmlQualifiedName.cs
@@ -12,6 +12,7 @@ namespace System.Xml
///
/// [To be supplied.]
///
+ [Serializable]
public class XmlQualifiedName
{
private string _name;
diff --git a/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathCompileException.cs b/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathCompileException.cs
index 6e1c0009c3..1edb5b96ed 100644
--- a/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathCompileException.cs
+++ b/src/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathCompileException.cs
@@ -7,6 +7,7 @@ using System.Text;
namespace System.Xml.Xsl.XPath
{
+ [Serializable]
internal class XPathCompileException : XslLoadException
{
public string queryString;
diff --git a/src/System.Private.Xml/src/System/Xml/Xsl/XslException.cs b/src/System.Private.Xml/src/System/Xml/Xsl/XslException.cs
index b7d2ccfc18..d5fb9993cb 100644
--- a/src/System.Private.Xml/src/System/Xml/Xsl/XslException.cs
+++ b/src/System.Private.Xml/src/System/Xml/Xsl/XslException.cs
@@ -11,6 +11,7 @@ using System.Xml.Xsl.Xslt;
namespace System.Xml.Xsl
{
+ [Serializable]
internal class XslTransformException : XsltException
{
public XslTransformException(Exception inner, string res, params string[] args)
@@ -90,6 +91,7 @@ namespace System.Xml.Xsl
}
}
+ [Serializable]
internal class XslLoadException : XslTransformException
{
private ISourceLineInfo _lineInfo;
diff --git a/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/CompilerError.cs b/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/CompilerError.cs
index 352fae50ed..966f670864 100644
--- a/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/CompilerError.cs
+++ b/src/System.Private.Xml/src/System/Xml/Xsl/Xslt/CompilerError.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Xml.Xsl.Xslt
{
+ [Serializable]
internal class CompilerError
{
public CompilerError(string fileName, int line, int column, string errorNumber, string errorText)
@@ -30,6 +31,7 @@ namespace System.Xml.Xsl.Xslt
public string FileName { get; set; }
}
+ [Serializable]
internal class CompilerErrorCollection : CollectionBase
{
public CompilerErrorCollection() { }
diff --git a/src/System.Private.Xml/src/System/Xml/Xslt/XsltException.cs b/src/System.Private.Xml/src/System/Xml/Xslt/XsltException.cs
index 2ee0f166a1..de050f3bef 100644
--- a/src/System.Private.Xml/src/System/Xml/Xslt/XsltException.cs
+++ b/src/System.Private.Xml/src/System/Xml/Xslt/XsltException.cs
@@ -9,6 +9,7 @@ using System.Xml.XPath;
namespace System.Xml.Xsl
{
+ [Serializable]
public class XsltException : SystemException
{
private string _res;
@@ -106,6 +107,7 @@ namespace System.Xml.Xsl
}
}
+ [Serializable]
public class XsltCompileException : XsltException
{
protected XsltCompileException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.cs b/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.cs
index 09b9a2bf3f..cd318d27f7 100644
--- a/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.cs
+++ b/src/System.Resources.ResourceManager/ref/System.Resources.ResourceManager.cs
@@ -31,6 +31,7 @@ namespace System.Resources
public MissingManifestResourceException(string message, System.Exception inner) { }
protected MissingManifestResourceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
+ [System.Serializable]
public class MissingSatelliteAssemblyException : System.SystemException
{
public MissingSatelliteAssemblyException(): base() { }
@@ -77,6 +78,7 @@ namespace System.Resources
protected UltimateResourceFallbackLocation FallbackLocation { get { throw null; } set { } }
public static ResourceManager CreateFileBasedResourceManager(string baseName, string resourceDir, System.Type usingResourceSet) { throw null; }
}
+ [System.Serializable]
public class ResourceSet : System.IDisposable, System.Collections.IEnumerable
{
protected ResourceSet() { }
diff --git a/src/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs b/src/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs
index f7977ecd8d..20bbafbf65 100644
--- a/src/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs
+++ b/src/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs
@@ -48,21 +48,25 @@ namespace System.Runtime.CompilerServices
public static partial class IsUdtReturn
{
}
+ [Serializable]
[AttributeUsage(AttributeTargets.Struct)]
public sealed class HasCopySemanticsAttribute : Attribute
{
public HasCopySemanticsAttribute(){}
}
+ [Serializable]
[AttributeUsage(AttributeTargets.Enum)]
public sealed class ScopelessEnumAttribute : Attribute
{
public ScopelessEnumAttribute(){}
}
+ [Serializable]
[AttributeUsage(AttributeTargets.Struct, Inherited = true)]
public sealed class NativeCppClassAttribute : Attribute
{
public NativeCppClassAttribute(){}
}
+ [Serializable]
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface,AllowMultiple=true, Inherited=false)]
public sealed class RequiredAttributeAttribute : Attribute
{
diff --git a/src/System.Runtime.Extensions/src/System/AppDomainUnloadedException.cs b/src/System.Runtime.Extensions/src/System/AppDomainUnloadedException.cs
index 48d5dc7230..7f7bebbe69 100644
--- a/src/System.Runtime.Extensions/src/System/AppDomainUnloadedException.cs
+++ b/src/System.Runtime.Extensions/src/System/AppDomainUnloadedException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System
{
+ [Serializable]
public class AppDomainUnloadedException : SystemException
{
internal const int COR_E_APPDOMAINUNLOADED = unchecked((int)0x80131014); // corresponds to __HResults.COR_E_APPDOMAINUNLOADED in corelib
diff --git a/src/System.Runtime.Extensions/src/System/ApplicationId.cs b/src/System.Runtime.Extensions/src/System/ApplicationId.cs
index bf37dd9c7a..c3a6b648fe 100644
--- a/src/System.Runtime.Extensions/src/System/ApplicationId.cs
+++ b/src/System.Runtime.Extensions/src/System/ApplicationId.cs
@@ -9,6 +9,7 @@ using System.Text;
namespace System
{
+ [Serializable]
public sealed class ApplicationId
{
private readonly byte[] _publicKeyToken;
diff --git a/src/System.Runtime.Extensions/src/System/CannotUnloadAppDomainException.cs b/src/System.Runtime.Extensions/src/System/CannotUnloadAppDomainException.cs
index 871a6fd97f..f78515ecdf 100644
--- a/src/System.Runtime.Extensions/src/System/CannotUnloadAppDomainException.cs
+++ b/src/System.Runtime.Extensions/src/System/CannotUnloadAppDomainException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System
{
+ [Serializable]
public class CannotUnloadAppDomainException : SystemException
{
internal const int COR_E_CANNOTUNLOADAPPDOMAIN = unchecked((int)0x80131015); // corresponds to __HResults.COR_E_CANNOTUNLOADAPPDOMAIN in corelib
diff --git a/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs b/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs
index 98b243b00d..b4f65c9a2a 100644
--- a/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs
+++ b/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs
@@ -859,6 +859,7 @@ namespace System.Collections
// This class wraps an IList, exposing it as a ArrayList
// Note this requires reimplementing half of ArrayList...
+ [Serializable]
private class IListWrapper : ArrayList
{
private IList _list;
@@ -1263,6 +1264,7 @@ namespace System.Collections
// This is the enumerator for an IList that's been wrapped in another
// class that implements all of ArrayList's methods.
+ [Serializable]
private sealed class IListWrapperEnumWrapper : IEnumerator, ICloneable
{
private IEnumerator _en;
@@ -1330,6 +1332,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class SyncArrayList : ArrayList
{
private ArrayList _list;
@@ -1685,6 +1688,7 @@ namespace System.Collections
}
+ [Serializable]
private class SyncIList : IList
{
private IList _list;
@@ -1814,6 +1818,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class FixedSizeList : IList
{
private IList _list;
@@ -1906,6 +1911,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class FixedSizeArrayList : ArrayList
{
private ArrayList _list;
@@ -2127,6 +2133,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class ReadOnlyList : IList
{
private IList _list;
@@ -2219,6 +2226,7 @@ namespace System.Collections
}
}
+ [Serializable]
private class ReadOnlyArrayList : ArrayList
{
private ArrayList _list;
@@ -2440,6 +2448,7 @@ namespace System.Collections
// Implements an enumerator for a ArrayList. The enumerator uses the
// internal version number of the list to ensure that no modifications are
// made to the list while an enumeration is in progress.
+ [Serializable]
private sealed class ArrayListEnumerator : IEnumerator, ICloneable
{
private ArrayList _list;
@@ -2500,6 +2509,7 @@ namespace System.Collections
// Implementation of a generic list subrange. An instance of this class
// is returned by the default implementation of List.GetRange.
+ [Serializable]
private class Range : ArrayList
{
private ArrayList _baseList;
@@ -2933,6 +2943,7 @@ namespace System.Collections
}
}
+ [Serializable]
private sealed class ArrayListEnumeratorSimple : IEnumerator, ICloneable
{
private ArrayList _list;
diff --git a/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs b/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs
index 145f063718..ac9ec620aa 100644
--- a/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs
+++ b/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs
@@ -1301,6 +1301,7 @@ namespace System.Collections
// Implements a Collection for the keys of a hashtable. An instance of this
// class is created by the GetKeys method of a hashtable.
+ [Serializable]
private class KeyCollection : ICollection
{
private Hashtable _hashtable;
@@ -1347,6 +1348,7 @@ namespace System.Collections
// Implements a Collection for the values of a hashtable. An instance of
// this class is created by the GetValues method of a hashtable.
+ [Serializable]
private class ValueCollection : ICollection
{
private Hashtable _hashtable;
@@ -1392,6 +1394,7 @@ namespace System.Collections
}
// Synchronized wrapper for hashtable
+ [Serializable]
private class SyncHashtable : Hashtable, IEnumerable
{
protected Hashtable _table;
@@ -1563,6 +1566,7 @@ namespace System.Collections
// Implements an enumerator for a hashtable. The enumerator uses the
// internal version number of the hashtable to ensure that no modifications
// are made to the hashtable while an enumeration is in progress.
+ [Serializable]
private class HashtableEnumerator : IDictionaryEnumerator, ICloneable
{
private Hashtable _hashtable;
diff --git a/src/System.Runtime.Extensions/src/System/Context.cs b/src/System.Runtime.Extensions/src/System/Context.cs
index 9e9f1ce3c0..e57690f31a 100644
--- a/src/System.Runtime.Extensions/src/System/Context.cs
+++ b/src/System.Runtime.Extensions/src/System/Context.cs
@@ -8,11 +8,13 @@ using System.Runtime.Serialization;
namespace System
{
+ [Serializable]
public abstract class ContextBoundObject : System.MarshalByRefObject
{
protected ContextBoundObject() { }
}
+ [Serializable]
public class ContextMarshalException : SystemException
{
public ContextMarshalException() : this(SR.Arg_ContextMarshalException, null)
@@ -34,6 +36,7 @@ namespace System
}
}
+ [Serializable]
[AttributeUsage(AttributeTargets.Field, Inherited = false)]
public partial class ContextStaticAttribute : System.Attribute
{
diff --git a/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs b/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs
index ed820ed03e..74717cbd33 100644
--- a/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs
+++ b/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs
@@ -36,6 +36,7 @@ namespace System.Globalization
}
}
+ [Serializable]
internal sealed class CultureAwareComparer : StringComparer
{
internal const CompareOptions ValidCompareMaskOffFlags =
diff --git a/src/System.Runtime.Extensions/src/System/IO/InvalidDataException.cs b/src/System.Runtime.Extensions/src/System/IO/InvalidDataException.cs
index 57f9fdeff2..0e2bc46dcb 100644
--- a/src/System.Runtime.Extensions/src/System/IO/InvalidDataException.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/InvalidDataException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.IO
{
+ [Serializable]
public sealed class InvalidDataException : SystemException
{
public InvalidDataException()
diff --git a/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs b/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs
index d425dfdd87..819d5e34a5 100644
--- a/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/StreamReader.cs
@@ -13,6 +13,7 @@ namespace System.IO
// This class implements a TextReader for reading characters to a Stream.
// This is designed for character input in a particular Encoding,
// whereas the Stream class is designed for byte input and output.
+ [Serializable]
public class StreamReader : TextReader
{
// StreamReader.Null is threadsafe.
diff --git a/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs b/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs
index 4f47c493af..79397d559e 100644
--- a/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/StreamWriter.cs
@@ -11,6 +11,7 @@ namespace System.IO
// This class implements a TextWriter for writing characters to a Stream.
// This is designed for character output in a particular Encoding,
// whereas the Stream class is designed for byte input and output.
+ [Serializable]
public class StreamWriter : TextWriter
{
// For UTF-8, the values of 1K for the default buffer size and 4K for the
diff --git a/src/System.Runtime.Extensions/src/System/IO/StringReader.cs b/src/System.Runtime.Extensions/src/System/IO/StringReader.cs
index 99bed6c2da..e76ec4f2e2 100644
--- a/src/System.Runtime.Extensions/src/System/IO/StringReader.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/StringReader.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
namespace System.IO
{
// This class implements a text reader that reads from a string.
+ [Serializable]
public class StringReader : TextReader
{
private string _s;
diff --git a/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs b/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs
index 94dff2db2d..c9d49ae505 100644
--- a/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/StringWriter.cs
@@ -10,6 +10,7 @@ namespace System.IO
{
// This class implements a text writer that writes to a string buffer and allows
// the resulting sequence of characters to be presented as a string.
+ [Serializable]
public class StringWriter : TextWriter
{
private static volatile UnicodeEncoding s_encoding = null;
diff --git a/src/System.Runtime.Extensions/src/System/IO/TextReader.cs b/src/System.Runtime.Extensions/src/System/IO/TextReader.cs
index a243461203..c668a9e175 100644
--- a/src/System.Runtime.Extensions/src/System/IO/TextReader.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/TextReader.cs
@@ -18,6 +18,7 @@ namespace System.IO
//
// This class is intended for character input, not bytes.
// There are methods on the Stream class for reading bytes.
+ [Serializable]
public abstract partial class TextReader : MarshalByRefObject, IDisposable
{
public static readonly TextReader Null = new NullTextReader();
@@ -251,6 +252,7 @@ namespace System.IO
}
#endregion
+ [Serializable]
private sealed class NullTextReader : TextReader
{
public NullTextReader() { }
@@ -274,6 +276,7 @@ namespace System.IO
return reader is SyncTextReader ? reader : new SyncTextReader(reader);
}
+ [Serializable]
internal sealed class SyncTextReader : TextReader
{
internal readonly TextReader _in;
diff --git a/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs b/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs
index ee0142115e..956f849914 100644
--- a/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs
+++ b/src/System.Runtime.Extensions/src/System/IO/TextWriter.cs
@@ -16,6 +16,7 @@ namespace System.IO
//
// This class is intended for character output, not bytes.
// There are methods on the Stream class for writing bytes.
+ [Serializable]
public abstract partial class TextWriter : MarshalByRefObject, IDisposable
{
public static readonly TextWriter Null = new NullTextWriter();
@@ -569,6 +570,7 @@ namespace System.IO
}
#endregion
+ [Serializable]
private sealed class NullTextWriter : TextWriter
{
internal NullTextWriter() : base(CultureInfo.InvariantCulture)
@@ -618,6 +620,7 @@ namespace System.IO
return writer is SyncTextWriter ? writer : new SyncTextWriter(writer);
}
+ [Serializable]
internal sealed class SyncTextWriter : TextWriter, IDisposable
{
private readonly TextWriter _out;
diff --git a/src/System.Runtime.Extensions/src/System/OperatingSystem.cs b/src/System.Runtime.Extensions/src/System/OperatingSystem.cs
index 5820c7e3c6..743442edfc 100644
--- a/src/System.Runtime.Extensions/src/System/OperatingSystem.cs
+++ b/src/System.Runtime.Extensions/src/System/OperatingSystem.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System
{
+ [Serializable]
public sealed class OperatingSystem : ISerializable, ICloneable
{
private readonly Version _version;
diff --git a/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs b/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs
index eb6b8220eb..0ada5754e3 100644
--- a/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs
+++ b/src/System.Runtime.Extensions/src/System/Runtime/Versioning/FrameworkName.cs
@@ -6,6 +6,7 @@ using System.Diagnostics;
namespace System.Runtime.Versioning
{
+ [Serializable]
public sealed class FrameworkName : IEquatable
{
private readonly string _identifier;
diff --git a/src/System.Runtime.Extensions/src/System/Security/Permissions/CodeAccessSecurityAttribute.cs b/src/System.Runtime.Extensions/src/System/Security/Permissions/CodeAccessSecurityAttribute.cs
index a816f1d016..1a681bcbff 100644
--- a/src/System.Runtime.Extensions/src/System/Security/Permissions/CodeAccessSecurityAttribute.cs
+++ b/src/System.Runtime.Extensions/src/System/Security/Permissions/CodeAccessSecurityAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public abstract partial class CodeAccessSecurityAttribute : SecurityAttribute
{
diff --git a/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityAttribute.cs b/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityAttribute.cs
index 73c0f891b8..3e78d3c43d 100644
--- a/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityAttribute.cs
+++ b/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public abstract partial class SecurityAttribute : Attribute
{
diff --git a/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityPermissionAttribute.cs b/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityPermissionAttribute.cs
index d7a896ec01..01b8b878f2 100644
--- a/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityPermissionAttribute.cs
+++ b/src/System.Runtime.Extensions/src/System/Security/Permissions/SecurityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class SecurityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Runtime.Extensions/src/System/Security/SecurityElement.cs b/src/System.Runtime.Extensions/src/System/Security/SecurityElement.cs
index 7af11e9dff..e676548415 100644
--- a/src/System.Runtime.Extensions/src/System/Security/SecurityElement.cs
+++ b/src/System.Runtime.Extensions/src/System/Security/SecurityElement.cs
@@ -21,6 +21,7 @@ namespace System.Security
string Attribute(string attributeName);
}
+ [Serializable]
public sealed class SecurityElement : ISecurityElementFactory
{
internal string _tag;
diff --git a/src/System.Runtime.InteropServices/src/System/Runtime/CompilerServices/Attributes.cs b/src/System.Runtime.InteropServices/src/System/Runtime/CompilerServices/Attributes.cs
index 6ccbc1c304..e25fca281d 100644
--- a/src/System.Runtime.InteropServices/src/System/Runtime/CompilerServices/Attributes.cs
+++ b/src/System.Runtime.InteropServices/src/System/Runtime/CompilerServices/Attributes.cs
@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
namespace System.Runtime.CompilerServices
{
+ [Serializable]
[System.AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
public sealed partial class IUnknownConstantAttribute : System.Runtime.CompilerServices.CustomConstantAttribute
{
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatter.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatter.cs
index 74e34d6879..06296610f8 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatter.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatter.cs
@@ -9,6 +9,7 @@ using System.Reflection;
namespace System.Runtime.Serialization
{
+ [Serializable]
[CLSCompliant(false)]
public abstract class Formatter : IFormatter
{
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryUtilClasses.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryUtilClasses.cs
index 40554f900f..c53599a7cd 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryUtilClasses.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/Formatters/Binary/BinaryUtilClasses.cs
@@ -192,6 +192,7 @@ namespace System.Runtime.Serialization.Formatters.Binary
}
// Implements a Growable array
+ [Serializable]
internal sealed class SizedArray : ICloneable
{
internal object[] _objects = null;
@@ -279,6 +280,7 @@ namespace System.Runtime.Serialization.Formatters.Binary
}
}
+ [Serializable]
internal sealed class IntSizedArray : ICloneable
{
internal int[] _objects = new int[16];
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/MemberHolder.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/MemberHolder.cs
index 08bc269354..bb2393f393 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/MemberHolder.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/MemberHolder.cs
@@ -6,6 +6,7 @@ using System.Reflection;
namespace System.Runtime.Serialization
{
+ [Serializable]
internal sealed class MemberHolder
{
internal readonly MemberInfo[] _members = null;
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectIDGenerator.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectIDGenerator.cs
index e6b465333e..fab0a64183 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectIDGenerator.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectIDGenerator.cs
@@ -6,6 +6,7 @@ using System.Runtime.CompilerServices;
namespace System.Runtime.Serialization
{
+ [Serializable]
public class ObjectIDGenerator
{
private const int NumBins = 4;
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectManager.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectManager.cs
index ad75822b80..5a4996e416 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectManager.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/ObjectManager.cs
@@ -1366,6 +1366,7 @@ namespace System.Runtime.Serialization
internal long ContainerID => _valueFixup != null ? _valueFixup.ContainerID : 0;
}
+ [Serializable]
internal sealed class FixupHolder
{
internal const int ArrayFixup = 0x1;
@@ -1388,6 +1389,7 @@ namespace System.Runtime.Serialization
}
}
+ [Serializable]
internal sealed class FixupHolderList
{
internal const int InitialSize = 2;
@@ -1432,6 +1434,7 @@ namespace System.Runtime.Serialization
}
}
+ [Serializable]
internal sealed class LongList
{
private const int InitialSize = 2;
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationBinder.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationBinder.cs
index 6a8adca577..50524064f1 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationBinder.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationBinder.cs
@@ -4,6 +4,7 @@
namespace System.Runtime.Serialization
{
+ [Serializable]
public abstract class SerializationBinder
{
public virtual void BindToName(Type serializedType, out string assemblyName, out string typeName)
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SurrogateSelector.cs b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SurrogateSelector.cs
index 6b49c58574..82078ef303 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SurrogateSelector.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SurrogateSelector.cs
@@ -186,6 +186,7 @@ namespace System.Runtime.Serialization
}
}
+ [Serializable]
internal sealed class SurrogateKey
{
internal readonly Type _type;
diff --git a/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs b/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
index c683b4b8f1..5cc81d0b75 100644
--- a/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
+++ b/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
@@ -72,6 +72,7 @@ namespace System.Runtime.Serialization
{
public IgnoreDataMemberAttribute() { }
}
+ [Serializable]
public partial class InvalidDataContractException : System.Exception
{
public InvalidDataContractException() { }
diff --git a/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs
index 7b581bd7cf..ea25d723cb 100644
--- a/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs
@@ -6,6 +6,7 @@ using System;
namespace System.Runtime.Serialization
{
+ [Serializable]
public partial class InvalidDataContractException : Exception
{
protected InvalidDataContractException(SerializationInfo info, StreamingContext context)
diff --git a/src/System.Runtime/src/System/LazyOfTTMetadata.cs b/src/System.Runtime/src/System/LazyOfTTMetadata.cs
index 07bb02c1ff..2af4cd5fec 100644
--- a/src/System.Runtime/src/System/LazyOfTTMetadata.cs
+++ b/src/System.Runtime/src/System/LazyOfTTMetadata.cs
@@ -8,6 +8,7 @@ using System.Threading;
namespace System
{
+ [Serializable]
public class Lazy : Lazy
{
private readonly TMetadata _metadata;
diff --git a/src/System.Security.AccessControl/src/System/Security/AccessControl/PrivilegeNotHeldException.cs b/src/System.Security.AccessControl/src/System/Security/AccessControl/PrivilegeNotHeldException.cs
index cdff814c92..5c8d6e7a19 100644
--- a/src/System.Security.AccessControl/src/System/Security/AccessControl/PrivilegeNotHeldException.cs
+++ b/src/System.Security.AccessControl/src/System/Security/AccessControl/PrivilegeNotHeldException.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Security.AccessControl
{
+ [Serializable]
public sealed class PrivilegeNotHeldException : UnauthorizedAccessException, ISerializable
{
private readonly string _privilegeName = null;
diff --git a/src/System.Security.Claims/src/System/Security/Claims/Claim.cs b/src/System.Security.Claims/src/System/Security/Claims/Claim.cs
index 91bf4de15e..c740b20496 100644
--- a/src/System.Security.Claims/src/System/Security/Claims/Claim.cs
+++ b/src/System.Security.Claims/src/System/Security/Claims/Claim.cs
@@ -13,6 +13,7 @@ namespace System.Security.Claims
/// A Claim consists of a Type, Value, a Subject and an Issuer.
/// Additional properties, ValueType, Properties and OriginalIssuer help understand the claim when making decisions.
///
+ [Serializable]
public class Claim
{
private enum SerializationMask
diff --git a/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs b/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs
index 2be94d75da..6a08b9121d 100644
--- a/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs
+++ b/src/System.Security.Claims/src/System/Security/Claims/ClaimsIdentity.cs
@@ -13,6 +13,7 @@ namespace System.Security.Claims
///
/// An Identity that is represented by a set of claims.
///
+ [Serializable]
public class ClaimsIdentity : IIdentity
{
private const string PreFix = "System.Security.ClaimsIdentity.";
diff --git a/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs b/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs
index 7d241de1bd..063e15a7ce 100644
--- a/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs
+++ b/src/System.Security.Claims/src/System/Security/Claims/ClaimsPrincipal.cs
@@ -13,6 +13,7 @@ namespace System.Security.Claims
///
/// Concrete IPrincipal supporting multiple claims-based identities
///
+ [Serializable]
public class ClaimsPrincipal : IPrincipal
{
private enum SerializationMask
diff --git a/src/System.Security.Claims/src/System/Security/Claims/GenericIdentity.cs b/src/System.Security.Claims/src/System/Security/Claims/GenericIdentity.cs
index 6887621111..3685c91a63 100644
--- a/src/System.Security.Claims/src/System/Security/Claims/GenericIdentity.cs
+++ b/src/System.Security.Claims/src/System/Security/Claims/GenericIdentity.cs
@@ -8,6 +8,7 @@ using System.Security.Claims;
namespace System.Security.Principal
{
+ [Serializable]
public class GenericIdentity : ClaimsIdentity
{
private readonly string m_name;
diff --git a/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs b/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs
index 5015f4f40b..659c439aa1 100644
--- a/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs
+++ b/src/System.Security.Claims/src/System/Security/Claims/GenericPrincipal.cs
@@ -9,6 +9,7 @@ using System.Security.Claims;
namespace System.Security.Principal
{
+ [Serializable]
public class GenericPrincipal : ClaimsPrincipal
{
private readonly IIdentity m_identity;
diff --git a/src/System.Security.Claims/tests/ClaimTests.cs b/src/System.Security.Claims/tests/ClaimTests.cs
index 858097f45c..af634b6f95 100644
--- a/src/System.Security.Claims/tests/ClaimTests.cs
+++ b/src/System.Security.Claims/tests/ClaimTests.cs
@@ -14,5 +14,21 @@ namespace System.Security.Claims
{
Assert.Throws(() => new Claim(null));
}
+
+ [Fact]
+ public void Claim_SerializeDeserialize_Roundtrip()
+ {
+ var id = new ClaimsIdentity("someAuthType", "someNameType", "someRoleType");
+ var c1 = new Claim("someType", "someValue", "someValueType", "anIssuer", "anOriginalIssuer", id);
+ Assert.Same(id, c1.Subject);
+
+ Claim c2 = BinaryFormatterHelpers.Clone(c1);
+ Assert.Equal(c1.Type, c2.Type);
+ Assert.Equal(c1.Value, c2.Value);
+ Assert.Equal(c1.ValueType, c2.ValueType);
+ Assert.Equal(c1.Issuer, c2.Issuer);
+ Assert.Equal(c1.OriginalIssuer, c2.OriginalIssuer);
+ Assert.Null(c2.Subject);
+ }
}
}
diff --git a/src/System.Security.Claims/tests/ClaimsIdentityTests.cs b/src/System.Security.Claims/tests/ClaimsIdentityTests.cs
index ef312a4e30..8ab80122fa 100644
--- a/src/System.Security.Claims/tests/ClaimsIdentityTests.cs
+++ b/src/System.Security.Claims/tests/ClaimsIdentityTests.cs
@@ -508,6 +508,22 @@ namespace System.Security.Claims
Assert.False(id.HasClaim("claim_type", "Xclaim_value"));
}
+ [Fact]
+ public void CustomClaimIdentity_SerializeDeserialize_Roundtrip()
+ {
+ var id1 = new CustomClaimsIdentity("someAuthType", "someNameType", "someRoleType");
+ ClaimsIdentity id2 = BinaryFormatterHelpers.Clone(id1);
+
+ Assert.Equal(id1.Actor, id2.Actor);
+ Assert.Equal(id1.AuthenticationType, id2.AuthenticationType);
+ Assert.Equal(id1.BootstrapContext, id2.BootstrapContext);
+ Assert.Equal(id1.IsAuthenticated, id2.IsAuthenticated);
+ Assert.Equal(id1.Label, id2.Label);
+ Assert.Equal(id1.Name, id2.Name);
+ Assert.Equal(id1.NameClaimType, id2.NameClaimType);
+ Assert.Equal(id1.RoleClaimType, id2.RoleClaimType);
+ }
+
[Serializable]
private sealed class CustomClaimsIdentity : ClaimsIdentity, ISerializable
{
diff --git a/src/System.Security.Claims/tests/ClaimsPrincipalTests.cs b/src/System.Security.Claims/tests/ClaimsPrincipalTests.cs
index 8b091aa493..a3165db0dd 100644
--- a/src/System.Security.Claims/tests/ClaimsPrincipalTests.cs
+++ b/src/System.Security.Claims/tests/ClaimsPrincipalTests.cs
@@ -202,6 +202,12 @@ namespace System.Security.Claims
AssertExtensions.Throws("reader", () => new ClaimsPrincipal((BinaryReader)null));
}
+ [Fact]
+ public void ClaimPrincipal_SerializeDeserialize_Roundtrip()
+ {
+ Assert.NotNull(BinaryFormatterHelpers.Clone(new ClaimsPrincipal()));
+ }
+
private class NonClaimsPrincipal : IPrincipal
{
public IIdentity Identity { get; set; }
diff --git a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs
index 917182ff1e..5bc00b52d6 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs
@@ -7,6 +7,7 @@ namespace System.Security.Cryptography
// DSAParameters is serializable so that one could pass the public parameters
// across a remote call, but we explicitly make the private key X non-serializable
// so you cannot accidently send it along with the public parameters.
+ [Serializable]
public struct DSAParameters
{
public byte[] P;
diff --git a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
index e7abbd06ff..78b04674d1 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
@@ -7,6 +7,7 @@ namespace System.Security.Cryptography
///
/// Wrapper for public key material passed between parties during Diffie-Hellman key material generation
///
+ [Serializable]
public abstract class ECDiffieHellmanPublicKey : IDisposable
{
private readonly byte[] _keyBlob;
diff --git a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs
index 73935ffdf0..bffb39701e 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs
@@ -9,6 +9,7 @@ using System.Security.Cryptography;
namespace System.Security.Cryptography
{
// We allow only the public components of an RSAParameters object, the Modulus and Exponent to be serializable.
+ [Serializable]
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct RSAParameters
{
diff --git a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithm.cs b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithm.cs
index d2884094af..6f69ef2047 100644
--- a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithm.cs
+++ b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithm.cs
@@ -13,6 +13,7 @@ namespace System.Security.Cryptography
/// which parameters are expected to be algorithms. We also provide a list of well known algorithm
/// names, which helps Intellisense users find a set of good algorithm names to use.
///
+ [Serializable]
public sealed class CngAlgorithm : IEquatable
{
public CngAlgorithm(string algorithm)
diff --git a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithmGroup.cs b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithmGroup.cs
index 2195835acf..d844808914 100644
--- a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithmGroup.cs
+++ b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngAlgorithmGroup.cs
@@ -14,6 +14,7 @@ namespace System.Security.Cryptography
/// provide a list of well known algorithm group names, which helps Intellisense users find a set of
/// good algorithm group names to use.
///
+ [Serializable]
public sealed class CngAlgorithmGroup : IEquatable
{
public CngAlgorithmGroup(string algorithmGroup)
diff --git a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKeyBlobFormat.cs b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKeyBlobFormat.cs
index 356db4d826..076f1c514b 100644
--- a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKeyBlobFormat.cs
+++ b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngKeyBlobFormat.cs
@@ -14,6 +14,7 @@ namespace System.Security.Cryptography
/// provide a list of well known blob formats, which helps Intellisense users find a set of good blob
/// formats to use.
///
+ [Serializable]
public sealed class CngKeyBlobFormat : IEquatable
{
public CngKeyBlobFormat(string format)
diff --git a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngProvider.cs b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngProvider.cs
index cd807854ce..facb495b63 100644
--- a/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngProvider.cs
+++ b/src/System.Security.Cryptography.Cng/src/System/Security/Cryptography/CngProvider.cs
@@ -13,6 +13,7 @@ namespace System.Security.Cryptography
/// which parameters are expected to be providers. We also provide a list of well known provider
/// names, which helps Intellisense users find a set of good provider names to use.
///
+ [Serializable]
public sealed class CngProvider : IEquatable
{
public CngProvider(string provider)
diff --git a/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/CryptographicUnexpectedOperationException.cs b/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/CryptographicUnexpectedOperationException.cs
index 31cdd8b3f0..1713a7782d 100644
--- a/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/CryptographicUnexpectedOperationException.cs
+++ b/src/System.Security.Cryptography.Primitives/src/System/Security/Cryptography/CryptographicUnexpectedOperationException.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.Security.Cryptography
{
+ [Serializable]
public class CryptographicUnexpectedOperationException : CryptographicException
{
public CryptographicUnexpectedOperationException()
diff --git a/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs b/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs
index 8f25201e54..4099dde040 100644
--- a/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs
+++ b/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs
@@ -12,6 +12,7 @@ using System.Text;
namespace System.Security.Cryptography.X509Certificates
{
+ [Serializable]
public class X509Certificate : IDisposable, IDeserializationCallback, ISerializable
{
private volatile byte[] _lazyCertHash;
diff --git a/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs b/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs
index 1b0ac1ddc6..124392b4c4 100644
--- a/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs
+++ b/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs
@@ -12,6 +12,7 @@ using System.Text;
namespace System.Security.Cryptography.X509Certificates
{
+ [Serializable]
public class X509Certificate2 : X509Certificate
{
private volatile byte[] _lazyRawData;
diff --git a/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509CertificateCollection.cs b/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509CertificateCollection.cs
index 935fa8d124..74f5ae1fa3 100644
--- a/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509CertificateCollection.cs
+++ b/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509CertificateCollection.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
namespace System.Security.Cryptography.X509Certificates
{
+ [Serializable]
public partial class X509CertificateCollection : System.Collections.CollectionBase
{
public X509CertificateCollection()
diff --git a/src/System.Security.Cryptography.X509Certificates/tests/CtorTests.cs b/src/System.Security.Cryptography.X509Certificates/tests/CtorTests.cs
index bbe093e4a9..897b930221 100644
--- a/src/System.Security.Cryptography.X509Certificates/tests/CtorTests.cs
+++ b/src/System.Security.Cryptography.X509Certificates/tests/CtorTests.cs
@@ -111,6 +111,34 @@ namespace System.Security.Cryptography.X509Certificates.Tests
}
}
+ [Fact]
+ public static void TestSerializeDeserialize_DER()
+ {
+ byte[] expectedThumbPrint = new byte[]
+ {
+ 0x10, 0x8e, 0x2b, 0xa2, 0x36, 0x32, 0x62, 0x0c,
+ 0x42, 0x7c, 0x57, 0x0b, 0x6d, 0x9d, 0xb5, 0x1a,
+ 0xc3, 0x13, 0x87, 0xfe,
+ };
+
+ Action assert = (c) =>
+ {
+ IntPtr h = c.Handle;
+ Assert.NotEqual(IntPtr.Zero, h);
+ byte[] actualThumbprint = c.GetCertHash();
+ Assert.Equal(expectedThumbPrint, actualThumbprint);
+ };
+
+ using (X509Certificate2 c = new X509Certificate2(TestData.MsCertificate))
+ {
+ assert(c);
+ using (X509Certificate2 c2 = System.Runtime.Serialization.Formatters.Tests.BinaryFormatterHelpers.Clone(c))
+ {
+ assert(c2);
+ }
+ }
+ }
+
[Fact]
public static void TestCopyConstructor_NoPal()
{
@@ -122,6 +150,17 @@ namespace System.Security.Cryptography.X509Certificates.Tests
}
}
+ [Fact]
+ public static void TestSerializeDeserialize_NoPal()
+ {
+ using (var c1 = new X509Certificate2())
+ using (var c2 = System.Runtime.Serialization.Formatters.Tests.BinaryFormatterHelpers.Clone(c1))
+ {
+ VerifyDefaultConstructor(c1);
+ VerifyDefaultConstructor(c2);
+ }
+ }
+
[Fact]
public static void TestCopyConstructor_Pal()
{
diff --git a/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CryptoSignedXmlRecursionException.cs b/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CryptoSignedXmlRecursionException.cs
index 7ecfdd6bc3..fd3a4bc7f1 100644
--- a/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CryptoSignedXmlRecursionException.cs
+++ b/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CryptoSignedXmlRecursionException.cs
@@ -13,6 +13,7 @@ namespace System.Security.Cryptography.Xml
/// hash. ComputeHash can throw different kind of exceptions.
/// This unique exception helps catch the recursion limit issue.
///
+ [Serializable]
internal class CryptoSignedXmlRecursionException : XmlException
{
public CryptoSignedXmlRecursionException() : base() { }
diff --git a/src/System.Security.Permissions/src/System/ApplicationIdentity.cs b/src/System.Security.Permissions/src/System/ApplicationIdentity.cs
index 6aadb987e5..f30253fb78 100644
--- a/src/System.Security.Permissions/src/System/ApplicationIdentity.cs
+++ b/src/System.Security.Permissions/src/System/ApplicationIdentity.cs
@@ -7,6 +7,7 @@ using System.Security;
namespace System
{
+ [Serializable]
public sealed class ApplicationIdentity : ISerializable
{
private ApplicationIdentity() { }
diff --git a/src/System.Security.Permissions/src/System/Data/Common/DBDataPermission.cs b/src/System.Security.Permissions/src/System/Data/Common/DBDataPermission.cs
index e2ae0e8fd6..6dfaafdf85 100644
--- a/src/System.Security.Permissions/src/System/Data/Common/DBDataPermission.cs
+++ b/src/System.Security.Permissions/src/System/Data/Common/DBDataPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Data.Common
{
+ [Serializable]
public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission
{
protected DBDataPermission() { }
diff --git a/src/System.Security.Permissions/src/System/Data/Common/DBDataPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Data/Common/DBDataPermissionAttribute.cs
index 87dcdf45d8..1ced75dbfd 100644
--- a/src/System.Security.Permissions/src/System/Data/Common/DBDataPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Data/Common/DBDataPermissionAttribute.cs
@@ -6,6 +6,7 @@ using System.Security.Permissions;
namespace System.Data.Common
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor| AttributeTargets.Method,
AllowMultiple =true, Inherited =false)]
public abstract class DBDataPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermission.cs b/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermission.cs
index 0b80d9eca1..3d9fa98a85 100644
--- a/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermission.cs
+++ b/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermission.cs
@@ -8,6 +8,7 @@ using System.Security.Permissions;
namespace System.Data.Odbc
{
+ [Serializable]
public sealed class OdbcPermission : DBDataPermission
{
public OdbcPermission() : base(default(PermissionState)) { }
diff --git a/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermissionAttribute.cs
index 12d35a22c4..c1cd668ae2 100644
--- a/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Data/Odbc/OdbcPermissionAttribute.cs
@@ -8,6 +8,7 @@ using System.Security.Permissions;
namespace System.Data.Odbc
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class OdbcPermissionAttribute : DBDataPermissionAttribute
diff --git a/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermission.cs b/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermission.cs
index f7c6bf09c4..5ea35948de 100644
--- a/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermission.cs
+++ b/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermission.cs
@@ -8,6 +8,7 @@ using System.Security.Permissions;
namespace System.Data.OleDb
{
+ [Serializable]
public sealed class OleDbPermission : DBDataPermission
{
public OleDbPermission() : base(default(PermissionState)) { }
diff --git a/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermissionAttribute.cs
index b6c753869a..53504d92d1 100644
--- a/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Data/OleDb/OleDbPermissionAttribute.cs
@@ -8,6 +8,7 @@ using System.Security.Permissions;
namespace System.Data.OleDb
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class OleDbPermissionAttribute : DBDataPermissionAttribute
diff --git a/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermission.cs b/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermission.cs
index da992613e3..07ade3da0f 100644
--- a/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermission.cs
+++ b/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Data.OracleClient
{
+ [Serializable]
public sealed class OraclePermission : CodeAccessPermission, IUnrestrictedPermission
{
public OraclePermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermissionAttribute.cs b/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermissionAttribute.cs
index 39956f6476..dbdae2bb91 100644
--- a/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Data/OracleClient/OraclePermissionAttribute.cs
@@ -6,6 +6,7 @@ using System.Security.Permissions;
namespace System.Data.OracleClient
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class OraclePermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermission.cs b/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermission.cs
index 7c2973ed59..09673b85ca 100644
--- a/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermission.cs
+++ b/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Data.SqlClient
{
+ [Serializable]
public sealed class SqlClientPermission : DBDataPermission
{
public SqlClientPermission() : base(default(PermissionState)) { }
diff --git a/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermissionAttribute.cs
index 59a711ca11..f63c6d10cb 100644
--- a/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Data/SqlClient/SqlClientPermissionAttribute.cs
@@ -8,6 +8,7 @@ using System.Security.Permissions;
namespace System.Data.SqlClient
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method,
AllowMultiple = true, Inherited = false)]
public sealed class SqlClientPermissionAttribute : DBDataPermissionAttribute
diff --git a/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionAttribute.cs
index 5562509516..cdd8116e2e 100644
--- a/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Diagnostics
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct
| AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Event, AllowMultiple = true, Inherited = false)]
public class EventLogPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntry.cs b/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntry.cs
index 3358b2674e..69d922c402 100644
--- a/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntry.cs
+++ b/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntry.cs
@@ -4,6 +4,7 @@
namespace System.Diagnostics
{
+ [Serializable]
public class EventLogPermissionEntry
{
public EventLogPermissionEntry(EventLogPermissionAccess permissionAccess, string machineName) { }
diff --git a/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntryCollection.cs b/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntryCollection.cs
index b9161e91e2..3b505e614a 100644
--- a/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntryCollection.cs
+++ b/src/System.Security.Permissions/src/System/Diagnostics/EventLogPermissionEntryCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Diagnostics
{
+ [Serializable]
public class EventLogPermissionEntryCollection : CollectionBase
{
internal EventLogPermissionEntryCollection() { }
diff --git a/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionAttribute.cs
index 7c95284aa2..9550ba1195 100644
--- a/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionAttribute.cs
@@ -6,6 +6,7 @@ using System.Security;
using System.Security.Permissions;
namespace System.Diagnostics
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Event,
AllowMultiple = true, Inherited = false)]
public class PerformanceCounterPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntry.cs b/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntry.cs
index 7b99594f25..379db41a43 100644
--- a/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntry.cs
+++ b/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntry.cs
@@ -4,6 +4,7 @@
namespace System.Diagnostics
{
+ [Serializable]
public class PerformanceCounterPermissionEntry
{
public PerformanceCounterPermissionEntry(PerformanceCounterPermissionAccess permissionAccess, string machineName, string categoryName) { }
diff --git a/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntryCollection.cs b/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntryCollection.cs
index 02ebea652c..4365f99184 100644
--- a/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntryCollection.cs
+++ b/src/System.Security.Permissions/src/System/Diagnostics/PerformanceCounterPermissionEntryCollection.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Diagnostics
{
+ [Serializable]
public class PerformanceCounterPermissionEntryCollection : CollectionBase
{
internal PerformanceCounterPermissionEntryCollection() { }
diff --git a/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermission.cs b/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermission.cs
index 93d1f89473..5aa5adeb69 100644
--- a/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermission.cs
+++ b/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Drawing.Printing
{
+ [Serializable]
public sealed class PrintingPermission : CodeAccessPermission, IUnrestrictedPermission
{
public PrintingPermission(PrintingPermissionLevel printingLevel) { }
diff --git a/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
index 6b968dd403..22d7348933 100644
--- a/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Drawing/Printing/PrintingPermissionAttribute.cs
@@ -6,6 +6,7 @@ using System.Security.Permissions;
namespace System.Drawing.Printing
{
+ [Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public sealed class PrintingPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Net/DnsPermission.cs b/src/System.Security.Permissions/src/System/Net/DnsPermission.cs
index 2df3e07647..94db975d84 100644
--- a/src/System.Security.Permissions/src/System/Net/DnsPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/DnsPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net
{
+ [Serializable]
public sealed class DnsPermission : CodeAccessPermission, IUnrestrictedPermission
{
public DnsPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Net/DnsPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/DnsPermissionAttribute.cs
index 3d8216e768..aed36a9387 100644
--- a/src/System.Security.Permissions/src/System/Net/DnsPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/DnsPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class |
AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class DnsPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Net/EndpointPermission.cs b/src/System.Security.Permissions/src/System/Net/EndpointPermission.cs
index 8d7628329d..9e1b63d0a5 100644
--- a/src/System.Security.Permissions/src/System/Net/EndpointPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/EndpointPermission.cs
@@ -4,6 +4,7 @@
namespace System.Net
{
+ [Serializable]
public class EndpointPermission
{
internal EndpointPermission() { }
diff --git a/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermission.cs b/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermission.cs
index c66a0308c2..9ca5d616e0 100644
--- a/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.Mail
{
+ [Serializable]
public sealed class SmtpPermission : CodeAccessPermission, IUnrestrictedPermission
{
public SmtpPermission(bool unrestricted) { }
diff --git a/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermissionAttribute.cs
index 5bc1531de2..0f4a62a4f1 100644
--- a/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/Mail/SmtpPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.Mail
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class |
AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class SmtpPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermission.cs b/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermission.cs
index 6e8463e6d3..ec51a5c88b 100644
--- a/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.NetworkInformation
{
+ [Serializable]
public sealed class NetworkInformationPermission : CodeAccessPermission, IUnrestrictedPermission
{
public NetworkInformationPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermissionAttribute.cs
index 0a12c62a73..7d218db261 100644
--- a/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/NetworkInformation/NetworkInformationPermissionAttribute.cs
@@ -8,6 +8,7 @@ using System.Security.Permissions;
namespace System.Net.NetworkInformation
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
+ [Serializable]
public sealed class NetworkInformationPermissionAttribute : CodeAccessSecurityAttribute
{
public NetworkInformationPermissionAttribute(SecurityAction action) : base(action) { }
diff --git a/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermission.cs b/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermission.cs
index 53a487519e..145dd401ca 100644
--- a/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.PeerToPeer.Collaboration
{
+ [Serializable]
public sealed class PeerCollaborationPermission : CodeAccessPermission, IUnrestrictedPermission
{
public PeerCollaborationPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermissionAttribute.cs
index d98362f501..3d367ef9c4 100644
--- a/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/PeerToPeer/Collaboration/PeerCollaborationPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.PeerToPeer.Collaboration
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class PeerCollaborationPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermission.cs b/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermission.cs
index 7a7ed974cf..344299f1be 100644
--- a/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.PeerToPeer
{
+ [Serializable]
public sealed class PnrpPermission : CodeAccessPermission, IUnrestrictedPermission
{
public PnrpPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermissionAttribute.cs
index 298e6072ee..e69086400b 100644
--- a/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/PeerToPeer/PnrpPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net.PeerToPeer
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct |
AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public sealed class PnrpPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Net/SocketPermission.cs b/src/System.Security.Permissions/src/System/Net/SocketPermission.cs
index 6e39441771..3da9e5351d 100644
--- a/src/System.Security.Permissions/src/System/Net/SocketPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/SocketPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net
{
+ [Serializable]
public sealed class SocketPermission : CodeAccessPermission, IUnrestrictedPermission
{
public const int AllPorts = -1;
diff --git a/src/System.Security.Permissions/src/System/Net/SocketPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/SocketPermissionAttribute.cs
index 8427922d73..2cde63a9c7 100644
--- a/src/System.Security.Permissions/src/System/Net/SocketPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/SocketPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class |
AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class SocketPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Net/WebPermission.cs b/src/System.Security.Permissions/src/System/Net/WebPermission.cs
index 1674a02204..b59c063129 100644
--- a/src/System.Security.Permissions/src/System/Net/WebPermission.cs
+++ b/src/System.Security.Permissions/src/System/Net/WebPermission.cs
@@ -9,6 +9,7 @@ using System.Text.RegularExpressions;
namespace System.Net
{
+ [Serializable]
public sealed class WebPermission : CodeAccessPermission, IUnrestrictedPermission
{
public WebPermission() { }
diff --git a/src/System.Security.Permissions/src/System/Net/WebPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Net/WebPermissionAttribute.cs
index e1d80710a7..d6b59fc1ab 100644
--- a/src/System.Security.Permissions/src/System/Net/WebPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Net/WebPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Net
{
+ [Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class |
AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class WebPermissionAttribute : CodeAccessSecurityAttribute
diff --git a/src/System.Security.Permissions/src/System/Security/CodeAccessPermission.cs b/src/System.Security.Permissions/src/System/Security/CodeAccessPermission.cs
index 7baaee4fe5..83fab56136 100644
--- a/src/System.Security.Permissions/src/System/Security/CodeAccessPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/CodeAccessPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security
{
+ [Serializable]
public abstract partial class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk
{
protected CodeAccessPermission() { }
diff --git a/src/System.Security.Permissions/src/System/Security/HostProtectionException.cs b/src/System.Security.Permissions/src/System/Security/HostProtectionException.cs
index ba9b55e13c..9551f59611 100644
--- a/src/System.Security.Permissions/src/System/Security/HostProtectionException.cs
+++ b/src/System.Security.Permissions/src/System/Security/HostProtectionException.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Security
{
+ [Serializable]
public partial class HostProtectionException : System.SystemException
{
public HostProtectionException() { }
diff --git a/src/System.Security.Permissions/src/System/Security/HostSecurityManager.cs b/src/System.Security.Permissions/src/System/Security/HostSecurityManager.cs
index 45f9b8af65..0e1e5fac6e 100644
--- a/src/System.Security.Permissions/src/System/Security/HostSecurityManager.cs
+++ b/src/System.Security.Permissions/src/System/Security/HostSecurityManager.cs
@@ -7,6 +7,7 @@ using System.Security.Policy;
namespace System.Security
{
+ [Serializable]
public partial class HostSecurityManager
{
public HostSecurityManager() { }
diff --git a/src/System.Security.Permissions/src/System/Security/NamedPermissionSet.cs b/src/System.Security.Permissions/src/System/Security/NamedPermissionSet.cs
index f5e710bc7c..59ce1678ff 100644
--- a/src/System.Security.Permissions/src/System/Security/NamedPermissionSet.cs
+++ b/src/System.Security.Permissions/src/System/Security/NamedPermissionSet.cs
@@ -6,6 +6,7 @@ using System.Security.Permissions;
namespace System.Security
{
+ [Serializable]
public sealed partial class NamedPermissionSet : PermissionSet
{
public NamedPermissionSet(NamedPermissionSet permSet) : base(default(PermissionState)) { }
diff --git a/src/System.Security.Permissions/src/System/Security/PermissionSet.cs b/src/System.Security.Permissions/src/System/Security/PermissionSet.cs
index 5c0724887e..fbf7d12ccf 100644
--- a/src/System.Security.Permissions/src/System/Security/PermissionSet.cs
+++ b/src/System.Security.Permissions/src/System/Security/PermissionSet.cs
@@ -8,6 +8,7 @@ using System.Runtime.Serialization;
namespace System.Security
{
+ [Serializable]
public partial class PermissionSet : ICollection, IEnumerable, IDeserializationCallback, ISecurityEncodable, IStackWalk
{
public PermissionSet(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermission.cs
index 835842e7cd..205bf91408 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class EnvironmentPermission : CodeAccessPermission, IUnrestrictedPermission
{
public EnvironmentPermission(EnvironmentPermissionAccess flag, string pathList) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermissionAttribute.cs
index 8ea41997db..e2dc203368 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/EnvironmentPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class EnvironmentPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermission.cs
index e5bb7c060f..d00edf3c20 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class FileDialogPermission : CodeAccessPermission, IUnrestrictedPermission
{
public FileDialogPermission(FileDialogPermissionAccess access) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermissionAttribute.cs
index 96ae5ee0b2..570b4780fc 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/FileDialogPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class FileDialogPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/FileIOPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/FileIOPermission.cs
index c852bf78b1..80b04cf437 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/FileIOPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/FileIOPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class FileIOPermission : CodeAccessPermission, IUnrestrictedPermission
{
public FileIOPermission(FileIOPermissionAccess access, string path) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermission.cs
index aa51d87f1c..ce7d1018c9 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class GacIdentityPermission : CodeAccessPermission
{
public GacIdentityPermission() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermissionAttribute.cs
index 8fef4f03fc..db60e48165 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/GacIdentityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/HostProtectionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/HostProtectionAttribute.cs
index 28ea982958..249975db21 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/HostProtectionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/HostProtectionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(4205), AllowMultiple = true, Inherited = false)]
public sealed partial class HostProtectionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/IDRole.cs b/src/System.Security.Permissions/src/System/Security/Permissions/IDRole.cs
index 0ba059f4b8..30fa46039c 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/IDRole.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/IDRole.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
internal sealed class IDRole
{
internal bool Authenticated { get; }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/PermissionSetAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/PermissionSetAttribute.cs
index 4cde5eaa60..cb54942bfe 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/PermissionSetAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/PermissionSetAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class PermissionSetAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermission.cs
index f7f3feb1fb..913ebd17b3 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermission.cs
@@ -9,6 +9,7 @@ using System.Threading;
namespace System.Security.Permissions
{
+ [Serializable]
public sealed class PrincipalPermission : IPermission, ISecurityEncodable, IUnrestrictedPermission
{
private IDRole[] _idArray;
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermissionAttribute.cs
index 28ef1a2705..a431a91df8 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/PrincipalPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(68), AllowMultiple = true, Inherited = false)]
public sealed partial class PrincipalPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermission.cs
index 102d8efe5b..006a02835b 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermission.cs
@@ -6,6 +6,7 @@ using System.Security.Cryptography.X509Certificates;
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class PublisherIdentityPermission : CodeAccessPermission
{
public PublisherIdentityPermission(X509Certificate certificate) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermissionAttribute.cs
index 20a621840b..591f7e132a 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/PublisherIdentityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class PublisherIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermission.cs
index 309c6b41c4..e4b053bf2f 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class ReflectionPermission : CodeAccessPermission, IUnrestrictedPermission
{
public ReflectionPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermissionAttribute.cs
index d300599ccc..3765748ea2 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/ReflectionPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class ReflectionPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermission.cs
index 366cee125f..db18f9a0de 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermission.cs
@@ -6,6 +6,7 @@ using System.Security.AccessControl;
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class RegistryPermission : CodeAccessPermission, IUnrestrictedPermission
{
public RegistryPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermissionAttribute.cs
index 8ea08e334e..a421b1fc83 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/RegistryPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class RegistryPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/ResourcePermissionBaseEntry.cs b/src/System.Security.Permissions/src/System/Security/Permissions/ResourcePermissionBaseEntry.cs
index c841992f97..79d4c16a88 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/ResourcePermissionBaseEntry.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/ResourcePermissionBaseEntry.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public class ResourcePermissionBaseEntry
{
public ResourcePermissionBaseEntry() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/SecurityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/SecurityPermission.cs
index e55fc22e2d..a93e4ef503 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/SecurityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/SecurityPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class SecurityPermission : CodeAccessPermission, IUnrestrictedPermission
{
public SecurityPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermission.cs
index 6b3eb077b8..f8e2701beb 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class SiteIdentityPermission : CodeAccessPermission
{
public SiteIdentityPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermissionAttribute.cs
index 79e166975f..bc48237b43 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/SiteIdentityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class SiteIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermission.cs
index 1d3d2b33a6..4935f76ff2 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class StrongNameIdentityPermission : CodeAccessPermission
{
public StrongNameIdentityPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermissionAttribute.cs
index 6aadbdefe8..a9964b9cbd 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/StrongNameIdentityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class StrongNameIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs b/src/System.Security.Permissions/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs
index fc8b83403f..a19e2bdbf8 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class StrongNamePublicKeyBlob
{
public StrongNamePublicKeyBlob(byte[] publicKey) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/TypeDescriptorPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/TypeDescriptorPermission.cs
index af454088be..da783e49a6 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/TypeDescriptorPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/TypeDescriptorPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class TypeDescriptorPermission : CodeAccessPermission, IUnrestrictedPermission
{
public TypeDescriptorPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/UIPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/UIPermission.cs
index b2ab6ab003..759de17a17 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/UIPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/UIPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class UIPermission : CodeAccessPermission, IUnrestrictedPermission
{
public UIPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/UIPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/UIPermissionAttribute.cs
index 2d0d9c6f8a..fd2ccb35a6 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/UIPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/UIPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class UIPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermission.cs
index 29ad6d05c1..4846d880c6 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class UrlIdentityPermission : CodeAccessPermission
{
public UrlIdentityPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermissionAttribute.cs
index 8a7a279fe9..e0e0212afe 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/UrlIdentityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class UrlIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermission.cs b/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermission.cs
index ff639f9fff..49425a31a3 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermission.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermission.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
public sealed partial class ZoneIdentityPermission : CodeAccessPermission
{
public ZoneIdentityPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermissionAttribute.cs
index 983b919d06..7ece753f43 100644
--- a/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Security/Permissions/ZoneIdentityPermissionAttribute.cs
@@ -4,6 +4,7 @@
namespace System.Security.Permissions
{
+ [Serializable]
[AttributeUsage((AttributeTargets)(109), AllowMultiple = true, Inherited = false)]
public sealed partial class ZoneIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/AllMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/AllMembershipCondition.cs
index 04887b0c0b..03d251399c 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/AllMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/AllMembershipCondition.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class AllMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public AllMembershipCondition() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectory.cs b/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectory.cs
index 1dc6fbbcbe..410b69d660 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectory.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectory.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class ApplicationDirectory : EvidenceBase
{
public ApplicationDirectory(string name) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectoryMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectoryMembershipCondition.cs
index 4a1bae3645..148f9573a1 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectoryMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/ApplicationDirectoryMembershipCondition.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class ApplicationDirectoryMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public ApplicationDirectoryMembershipCondition() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/ApplicationTrust.cs b/src/System.Security.Permissions/src/System/Security/Policy/ApplicationTrust.cs
index 86190d603f..1a686459f1 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/ApplicationTrust.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/ApplicationTrust.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class ApplicationTrust : EvidenceBase, ISecurityEncodable
{
public ApplicationTrust() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/CodeConnectAccess.cs b/src/System.Security.Permissions/src/System/Security/Policy/CodeConnectAccess.cs
index f6410232c4..7adb15f35d 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/CodeConnectAccess.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/CodeConnectAccess.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public partial class CodeConnectAccess
{
public static readonly string AnyScheme;
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/CodeGroup.cs b/src/System.Security.Permissions/src/System/Security/Policy/CodeGroup.cs
index 352730b250..9af7c11e80 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/CodeGroup.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/CodeGroup.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Security.Policy
{
+ [Serializable]
public abstract partial class CodeGroup
{
protected CodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/Evidence.cs b/src/System.Security.Permissions/src/System/Security/Policy/Evidence.cs
index f04b536e0a..2e40c8a6c9 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/Evidence.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/Evidence.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class Evidence : ICollection, IEnumerable
{
public Evidence() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/EvidenceBase.cs b/src/System.Security.Permissions/src/System/Security/Policy/EvidenceBase.cs
index 22be780fe2..d56bf6edb6 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/EvidenceBase.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/EvidenceBase.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public abstract partial class EvidenceBase
{
protected EvidenceBase() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/FileCodeGroup.cs b/src/System.Security.Permissions/src/System/Security/Policy/FileCodeGroup.cs
index 20a4135ba1..b901ba2df6 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/FileCodeGroup.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/FileCodeGroup.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class FileCodeGroup : CodeGroup
{
public FileCodeGroup(IMembershipCondition membershipCondition, Permissions.FileIOPermissionAccess access) : base(default(IMembershipCondition), default(PolicyStatement)) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/FirstMatchCodeGroup.cs b/src/System.Security.Permissions/src/System/Security/Policy/FirstMatchCodeGroup.cs
index 80b43f75ff..e53f97c6ba 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/FirstMatchCodeGroup.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/FirstMatchCodeGroup.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class FirstMatchCodeGroup : CodeGroup
{
public FirstMatchCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy) : base(default(IMembershipCondition), default(PolicyStatement)) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/GacInstalled.cs b/src/System.Security.Permissions/src/System/Security/Policy/GacInstalled.cs
index 8414be9234..f0772a5add 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/GacInstalled.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/GacInstalled.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class GacInstalled : EvidenceBase, IIdentityPermissionFactory
{
public GacInstalled() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/GacMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/GacMembershipCondition.cs
index 315d737d32..ed29b6e907 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/GacMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/GacMembershipCondition.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class GacMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public GacMembershipCondition() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/Hash.cs b/src/System.Security.Permissions/src/System/Security/Policy/Hash.cs
index e8bf589c28..48d48604f2 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/Hash.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/Hash.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class Hash : EvidenceBase, System.Runtime.Serialization.ISerializable
{
public Hash(System.Reflection.Assembly assembly) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/HashMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/HashMembershipCondition.cs
index 5af6b46f94..4a10d39053 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/HashMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/HashMembershipCondition.cs
@@ -7,6 +7,7 @@ using System.Security.Cryptography;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class HashMembershipCondition : IDeserializationCallback, ISerializable, ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public HashMembershipCondition(HashAlgorithm hashAlg, byte[] value) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/NetCodeGroup.cs b/src/System.Security.Permissions/src/System/Security/Policy/NetCodeGroup.cs
index 904bf1928c..6ec9fe7b58 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/NetCodeGroup.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/NetCodeGroup.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class NetCodeGroup : CodeGroup
{
public static readonly string AbsentOriginScheme;
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/PermissionRequestEvidence.cs b/src/System.Security.Permissions/src/System/Security/Policy/PermissionRequestEvidence.cs
index ce86576f2a..629c625fa9 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/PermissionRequestEvidence.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/PermissionRequestEvidence.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class PermissionRequestEvidence : EvidenceBase
{
public PermissionRequestEvidence(PermissionSet request, PermissionSet optional, PermissionSet denied) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/PolicyException.cs b/src/System.Security.Permissions/src/System/Security/Policy/PolicyException.cs
index a125ca84e4..b92c0b3f96 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/PolicyException.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/PolicyException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Security.Policy
{
+ [Serializable]
public partial class PolicyException : System.SystemException
{
public PolicyException() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/PolicyLevel.cs b/src/System.Security.Permissions/src/System/Security/Policy/PolicyLevel.cs
index 8210482386..350a0e7f97 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/PolicyLevel.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/PolicyLevel.cs
@@ -6,6 +6,7 @@ using System.Collections;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class PolicyLevel
{
internal PolicyLevel() { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/PolicyStatement.cs b/src/System.Security.Permissions/src/System/Security/Policy/PolicyStatement.cs
index b9889a5ba4..280cb47a28 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/PolicyStatement.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/PolicyStatement.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class PolicyStatement : ISecurityEncodable, ISecurityPolicyEncodable
{
public PolicyStatement(PermissionSet permSet) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/Publisher.cs b/src/System.Security.Permissions/src/System/Security/Policy/Publisher.cs
index 7ff02c25f7..469a0f1dc2 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/Publisher.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/Publisher.cs
@@ -6,6 +6,7 @@ using System.Security.Cryptography.X509Certificates;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class Publisher : EvidenceBase, IIdentityPermissionFactory
{
public Publisher(X509Certificate cert) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/PublisherMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/PublisherMembershipCondition.cs
index 72994bf08a..3ad64807b6 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/PublisherMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/PublisherMembershipCondition.cs
@@ -6,6 +6,7 @@ using System.Security.Cryptography.X509Certificates;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class PublisherMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public PublisherMembershipCondition(X509Certificate certificate) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/Site.cs b/src/System.Security.Permissions/src/System/Security/Policy/Site.cs
index 5da66cc96f..4bb9a0c37b 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/Site.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/Site.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class Site : EvidenceBase, IIdentityPermissionFactory
{
public Site(string name) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/SiteMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/SiteMembershipCondition.cs
index f8852249f9..434b3b6c72 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/SiteMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/SiteMembershipCondition.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class SiteMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public SiteMembershipCondition(string site) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/StrongName.cs b/src/System.Security.Permissions/src/System/Security/Policy/StrongName.cs
index 1cc6e53b92..42127fff15 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/StrongName.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/StrongName.cs
@@ -6,6 +6,7 @@ using System.Security.Permissions;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class StrongName : EvidenceBase, IIdentityPermissionFactory
{
public StrongName(StrongNamePublicKeyBlob blob, string name, Version version) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/StrongNameMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/StrongNameMembershipCondition.cs
index cc6bfc61fc..9a68b74896 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/StrongNameMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/StrongNameMembershipCondition.cs
@@ -6,6 +6,7 @@ using System.Security.Permissions;
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class StrongNameMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
{
public StrongNameMembershipCondition(StrongNamePublicKeyBlob blob, string name, Version version) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/UnionCodeGroup.cs b/src/System.Security.Permissions/src/System/Security/Policy/UnionCodeGroup.cs
index bf273add06..5c63b20035 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/UnionCodeGroup.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/UnionCodeGroup.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class UnionCodeGroup : CodeGroup
{
public UnionCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy) : base(default(IMembershipCondition), default(PolicyStatement)) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/Url.cs b/src/System.Security.Permissions/src/System/Security/Policy/Url.cs
index 0e6b17854d..52cbc57943 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/Url.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/Url.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class Url : EvidenceBase, IIdentityPermissionFactory
{
public Url(string name) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/UrlMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/UrlMembershipCondition.cs
index a0b2d45e7c..3ffe8c1009 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/UrlMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/UrlMembershipCondition.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class UrlMembershipCondition : ISecurityEncodable, IMembershipCondition, ISecurityPolicyEncodable
{
public UrlMembershipCondition(string url) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/Zone.cs b/src/System.Security.Permissions/src/System/Security/Policy/Zone.cs
index 7eea3f5798..f3678e334b 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/Zone.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/Zone.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class Zone : EvidenceBase, IIdentityPermissionFactory
{
public Zone(SecurityZone zone) { }
diff --git a/src/System.Security.Permissions/src/System/Security/Policy/ZoneMembershipCondition.cs b/src/System.Security.Permissions/src/System/Security/Policy/ZoneMembershipCondition.cs
index 392869ad64..058c909790 100644
--- a/src/System.Security.Permissions/src/System/Security/Policy/ZoneMembershipCondition.cs
+++ b/src/System.Security.Permissions/src/System/Security/Policy/ZoneMembershipCondition.cs
@@ -4,6 +4,7 @@
namespace System.Security.Policy
{
+ [Serializable]
public sealed partial class ZoneMembershipCondition : ISecurityEncodable, IMembershipCondition
{
public ZoneMembershipCondition(SecurityZone zone) { }
diff --git a/src/System.Security.Permissions/src/System/Security/XmlSyntaxException.cs b/src/System.Security.Permissions/src/System/Security/XmlSyntaxException.cs
index 8554181d6d..7d2ee515c9 100644
--- a/src/System.Security.Permissions/src/System/Security/XmlSyntaxException.cs
+++ b/src/System.Security.Permissions/src/System/Security/XmlSyntaxException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Security
{
+ [Serializable]
public sealed partial class XmlSyntaxException : SystemException
{
public XmlSyntaxException() { }
diff --git a/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermission.cs b/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermission.cs
index 9c7871d53b..9ac02935c8 100644
--- a/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermission.cs
+++ b/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermission.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Transactions
{
+ [Serializable]
public sealed class DistributedTransactionPermission : CodeAccessPermission, IUnrestrictedPermission
{
public DistributedTransactionPermission(PermissionState state) { }
diff --git a/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermissionAttribute.cs b/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermissionAttribute.cs
index af214f4ef0..c24a0aba90 100644
--- a/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermissionAttribute.cs
+++ b/src/System.Security.Permissions/src/System/Transactions/DistributedTransactionPermissionAttribute.cs
@@ -7,6 +7,7 @@ using System.Security.Permissions;
namespace System.Transactions
{
+ [Serializable]
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
public sealed class DistributedTransactionPermissionAttribute : CodeAccessSecurityAttribute
{
diff --git a/src/System.Security.Principal.Windows/src/System/Security/Principal/IdentityNotMappedException.cs b/src/System.Security.Principal.Windows/src/System/Security/Principal/IdentityNotMappedException.cs
index b7f0d0c69a..7696e68e26 100644
--- a/src/System.Security.Principal.Windows/src/System/Security/Principal/IdentityNotMappedException.cs
+++ b/src/System.Security.Principal.Windows/src/System/Security/Principal/IdentityNotMappedException.cs
@@ -6,6 +6,7 @@ using System.Runtime.Serialization;
namespace System.Security.Principal
{
+ [Serializable]
public sealed class IdentityNotMappedException : SystemException
{
private IdentityReferenceCollection _unmappedIdentities;
diff --git a/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs b/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
index 0b752521e3..b2ed7cef14 100644
--- a/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
+++ b/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs
@@ -24,6 +24,7 @@ using System.Runtime.Serialization;
namespace System.Security.Principal
{
+ [Serializable]
public class WindowsIdentity : ClaimsIdentity, IDisposable, ISerializable, IDeserializationCallback
{
private string _name = null;
diff --git a/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs b/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs
index 9ba6386ec1..da945f84ce 100644
--- a/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs
+++ b/src/System.Security.Principal.Windows/src/System/Security/Principal/WindowsPrincipal.cs
@@ -24,6 +24,7 @@ namespace System.Security.Principal
Replicator = 0x228
}
+ [Serializable]
public class WindowsPrincipal : ClaimsPrincipal
{
private WindowsIdentity _identity = null;
diff --git a/src/System.Security.Principal.Windows/tests/WindowsIdentityTests.cs b/src/System.Security.Principal.Windows/tests/WindowsIdentityTests.cs
index 0421fcbbbf..4d8978b760 100644
--- a/src/System.Security.Principal.Windows/tests/WindowsIdentityTests.cs
+++ b/src/System.Security.Principal.Windows/tests/WindowsIdentityTests.cs
@@ -51,7 +51,9 @@ public class WindowsIdentityTests
}
[Theory]
- public static void CloneAndProperties()
+ [InlineData(false)]
+ [InlineData(true)]
+ public static void CloneAndProperties(bool cloneViaSerialization)
{
SafeAccessTokenHandle token = WindowsIdentity.GetCurrent().AccessToken;
bool gotRef = false;
@@ -61,7 +63,9 @@ public class WindowsIdentityTests
IntPtr logonToken = token.DangerousGetHandle();
WindowsIdentity winId = new WindowsIdentity(logonToken);
- WindowsIdentity cloneWinId = winId.Clone() as WindowsIdentity;
+ WindowsIdentity cloneWinId = cloneViaSerialization ?
+ BinaryFormatterHelpers.Clone(winId) :
+ winId.Clone() as WindowsIdentity;
Assert.NotNull(cloneWinId);
Assert.Equal(winId.IsSystem, cloneWinId.IsSystem);
diff --git a/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs b/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs
index 600d37744c..7c4c909d4d 100644
--- a/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs
+++ b/src/System.ServiceProcess.ServiceController/src/System/ServiceProcess/TimeoutException.cs
@@ -7,6 +7,7 @@ using System.Runtime.Serialization;
namespace System.ServiceProcess
{
+ [Serializable]
public class TimeoutException : Exception
{
private const int ServiceControllerTimeout = unchecked((int)0x80131906);
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs
index fdbcfaf06f..406f8a51f4 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/BaseCodePageEncoding.cs
@@ -41,6 +41,7 @@ namespace System.Text
// WORD byteReplace; // 2 bytes = 48 // default replacement byte(s)
// BYTE[] data; // data section
// }
+ [Serializable]
internal abstract class BaseCodePageEncoding : EncodingNLS, ISerializable
{
internal const String CODE_PAGE_DATA_FILE_NAME = "codepages.nlp";
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/DBCSCodePageEncoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/DBCSCodePageEncoding.cs
index 63e638559d..ee183276bf 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/DBCSCodePageEncoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/DBCSCodePageEncoding.cs
@@ -14,6 +14,7 @@ namespace System.Text
{
// DBCSCodePageEncoding
//
+ [Serializable]
internal class DBCSCodePageEncoding : BaseCodePageEncoding
{
// Pointers to our memory section parts
@@ -1160,6 +1161,7 @@ namespace System.Text
return new DBCSDecoder(this);
}
+ [Serializable]
internal class DBCSDecoder : DecoderNLS
{
// Need a place for the last left over byte
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/DecoderBestFitFallback.cs b/src/System.Text.Encoding.CodePages/src/System/Text/DecoderBestFitFallback.cs
index 0623264af5..1c9c4af6ae 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/DecoderBestFitFallback.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/DecoderBestFitFallback.cs
@@ -13,6 +13,7 @@ using System.Diagnostics;
namespace System.Text
{
+ [Serializable]
internal sealed class InternalDecoderBestFitFallback : DecoderFallback
{
// Our variables
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/DecoderNLS.cs b/src/System.Text.Encoding.CodePages/src/System/Text/DecoderNLS.cs
index 1142871621..0f17a0242c 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/DecoderNLS.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/DecoderNLS.cs
@@ -21,6 +21,7 @@ namespace System.Text
// class are typically obtained through calls to the GetDecoder method
// of Encoding objects.
//
+ [Serializable]
internal class DecoderNLS : Decoder, ISerializable
{
// Remember our encoding
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/EUCJPEncoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/EUCJPEncoding.cs
index f3ce363409..d438d1093d 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/EUCJPEncoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/EUCJPEncoding.cs
@@ -45,6 +45,7 @@ using System;
namespace System.Text
{
+ [Serializable]
internal class EUCJPEncoding : DBCSCodePageEncoding
{
// This pretends to be CP 932 as far as memory tables are concerned.
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/EncoderBestFitFallback.cs b/src/System.Text.Encoding.CodePages/src/System/Text/EncoderBestFitFallback.cs
index 8adc731232..a755d3ae21 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/EncoderBestFitFallback.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/EncoderBestFitFallback.cs
@@ -15,6 +15,7 @@ using System.Threading;
namespace System.Text
{
+ [Serializable]
internal class InternalEncoderBestFitFallback : EncoderFallback
{
// Our variables
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/EncoderNLS.cs b/src/System.Text.Encoding.CodePages/src/System/Text/EncoderNLS.cs
index 49fb977d41..f29d5bd81d 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/EncoderNLS.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/EncoderNLS.cs
@@ -20,6 +20,7 @@ namespace System.Text
// class are typically obtained through calls to the GetEncoder method
// of Encoding objects.
//
+ [Serializable]
internal class EncoderNLS : Encoder, ISerializable
{
// Need a place for the last left over character, most of our encodings use this
@@ -44,7 +45,7 @@ namespace System.Text
{
throw new PlatformNotSupportedException();
}
-
+
internal new EncoderFallback Fallback
{
get { return m_fallback; }
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/EncodingNLS.cs b/src/System.Text.Encoding.CodePages/src/System/Text/EncodingNLS.cs
index 93c4e2c7de..87b246d2c4 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/EncodingNLS.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/EncodingNLS.cs
@@ -21,6 +21,7 @@ namespace System.Text
// encodings.
// So if you change the wrappers in this class, you must change the wrappers in the other classes
// as well because they should have the same behavior.
+ [Serializable]
internal abstract class EncodingNLS : Encoding
{
private string _encodingName;
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/GB18030Encoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/GB18030Encoding.cs
index 38fb0fd6f0..522886819e 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/GB18030Encoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/GB18030Encoding.cs
@@ -101,6 +101,7 @@ namespace System.Text
**
==============================================================================*/
+ [Serializable]
internal sealed class GB18030Encoding : DBCSCodePageEncoding
{
// This is the table of 4 byte conversions.
@@ -794,6 +795,7 @@ namespace System.Text
return new GB18030Decoder(this);
}
+ [Serializable]
internal sealed class GB18030Decoder : DecoderNLS
{
internal short bLeftOver1 = -1;
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/ISCIIEncoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/ISCIIEncoding.cs
index 1917907cd8..779fa4d26c 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/ISCIIEncoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/ISCIIEncoding.cs
@@ -28,6 +28,7 @@ namespace System.Text
// Forms D & KD have things like 0934, which decomposes to 0933 + 093C, so not normal.
// Form IDNA has the above problems plus case mapping, so false (like most encodings)
//
+ [Serializable]
internal class ISCIIEncoding : EncodingNLS, ISerializable
{
// Constants
@@ -715,6 +716,7 @@ namespace System.Text
return _defaultCodePage + EncoderFallback.GetHashCode() + DecoderFallback.GetHashCode();
}
+ [Serializable]
internal class ISCIIEncoder : EncoderNLS
{
// Need to remember the default code page (for HasState)
@@ -753,6 +755,7 @@ namespace System.Text
}
}
+ [Serializable]
internal class ISCIIDecoder : DecoderNLS
{
// Need a place to store any our current code page and last ATR flag
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/ISO2022Encoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/ISO2022Encoding.cs
index 40012624a0..6a74ed7442 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/ISO2022Encoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/ISO2022Encoding.cs
@@ -49,6 +49,7 @@ namespace System.Text
**
==============================================================================*/
+ [Serializable]
internal class ISO2022Encoding : DBCSCodePageEncoding
{
private const byte SHIFT_OUT = (byte)0x0E;
@@ -1804,6 +1805,7 @@ namespace System.Text
return new ISO2022Decoder(this);
}
+ [Serializable]
internal class ISO2022Encoder : System.Text.EncoderNLS
{
internal ISO2022Modes currentMode;
@@ -1836,6 +1838,7 @@ namespace System.Text
}
}
+ [Serializable]
internal class ISO2022Decoder : System.Text.DecoderNLS
{
internal byte[] bytesLeftOver;
diff --git a/src/System.Text.Encoding.CodePages/src/System/Text/SBCSCodePageEncoding.cs b/src/System.Text.Encoding.CodePages/src/System/Text/SBCSCodePageEncoding.cs
index c0c67fa9a9..188c74133d 100644
--- a/src/System.Text.Encoding.CodePages/src/System/Text/SBCSCodePageEncoding.cs
+++ b/src/System.Text.Encoding.CodePages/src/System/Text/SBCSCodePageEncoding.cs
@@ -13,6 +13,7 @@ using System.Security;
namespace System.Text
{
+ [Serializable]
internal class SBCSCodePageEncoding : BaseCodePageEncoding
{
// Pointers to our memory section parts
diff --git a/src/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs b/src/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs
index a058eaca7f..f6c2c87ab7 100644
--- a/src/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs
+++ b/src/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs
@@ -495,6 +495,9 @@ namespace System.Text.Tests
Assert.Equal(encoding.CodePage, (int)mapping[0]);
Assert.Equal(encoding.WebName, (string)mapping[1]);
+ // If available, validate serializing and deserializing with BinaryFormatter
+ ValidateSerializeDeserialize(encoding);
+
// Get encoding via query string.
Assert.Equal(Encoding.GetEncoding((string)mapping[2]), CodePagesEncodingProvider.Instance.GetEncoding((string)mapping[2]));
}
@@ -514,6 +517,47 @@ namespace System.Text.Tests
TestRegister1252();
}
+ static void ValidateSerializeDeserialize(Encoding e)
+ {
+ // Make sure the Encoding roundtrips
+ Assert.Equal(e, BinaryFormatterHelpers.Clone(e));
+
+ // Get an encoder and decoder from the encoding, and clone them
+ Encoder origEncoder = e.GetEncoder();
+ Decoder origDecoder = e.GetDecoder();
+ Encoder clonedEncoder = BinaryFormatterHelpers.Clone(origEncoder);
+ Decoder clonedDecoder = BinaryFormatterHelpers.Clone(origDecoder);
+
+ // Encode and decode some text with each pairing
+ const string InputText = "abcdefghijklmnopqrstuvwxyz";
+ char[] inputTextChars = InputText.ToCharArray();
+ var pairs = new[]
+ {
+ Tuple.Create(origEncoder, origDecoder),
+ Tuple.Create(origEncoder, clonedDecoder),
+ Tuple.Create(clonedEncoder, origDecoder),
+ Tuple.Create(clonedEncoder, clonedDecoder),
+ };
+ var results = new List();
+ foreach (Tuple pair in pairs)
+ {
+ byte[] encodedBytes = new byte[pair.Item1.GetByteCount(inputTextChars, 0, inputTextChars.Length, true)];
+ Assert.Equal(encodedBytes.Length, pair.Item1.GetBytes(inputTextChars, 0, inputTextChars.Length, encodedBytes, 0, true));
+ char[] decodedChars = new char[pair.Item2.GetCharCount(encodedBytes, 0, encodedBytes.Length)];
+ Assert.Equal(decodedChars.Length, pair.Item2.GetChars(encodedBytes, 0, encodedBytes.Length, decodedChars, 0));
+ results.Add(decodedChars);
+ }
+
+ // Validate that all of the pairings produced the same results
+ foreach (char[] a in results)
+ {
+ foreach (char[] b in results)
+ {
+ Assert.Equal(a, b);
+ }
+ }
+ }
+
private static void ValidateDefaultEncodings()
{
foreach (var mapping in CrossplatformDefaultEncodings())
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
index 9b6c128d08..70d494f623 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
@@ -19,6 +19,7 @@ namespace System.Text.RegularExpressions
/// contains static methods that allow use of regular expressions without instantiating
/// a Regex explicitly.
///
+ [Serializable]
public class Regex : ISerializable
{
protected internal string pattern; // The string pattern provided
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCapture.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCapture.cs
index 16233f8603..060d1a0652 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCapture.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCapture.cs
@@ -13,6 +13,7 @@ namespace System.Text.RegularExpressions
/// Represents the results from a single subexpression capture. The object represents
/// one substring for a single successful capture.
///
+ [Serializable]
public class Capture
{
internal string _text;
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCaptureCollection.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCaptureCollection.cs
index e306088d50..b4bf1d0101 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCaptureCollection.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCaptureCollection.cs
@@ -22,6 +22,7 @@ namespace System.Text.RegularExpressions
///
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(RegexCollectionDebuggerProxy))]
+ [Serializable]
public class CaptureCollection : IList, IReadOnlyList, IList
{
private readonly Group _group;
@@ -191,6 +192,7 @@ namespace System.Text.RegularExpressions
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}
+ [Serializable]
private sealed class Enumerator : IEnumerator
{
private readonly CaptureCollection _collection;
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroup.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroup.cs
index a748ccf349..b84359e472 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroup.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroup.cs
@@ -13,6 +13,7 @@ namespace System.Text.RegularExpressions
/// capture zero, one, or more strings in a single match because of quantifiers, so
/// Group supplies a collection of Capture objects.
///
+ [Serializable]
public class Group : Capture
{
// the empty group object
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroupCollection.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroupCollection.cs
index f13ea13e73..bb68ae3bc1 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroupCollection.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroupCollection.cs
@@ -17,6 +17,7 @@ namespace System.Text.RegularExpressions
///
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(RegexCollectionDebuggerProxy))]
+ [Serializable]
public class GroupCollection : IList, IReadOnlyList, IList
{
private readonly Match _match;
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatch.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatch.cs
index 093097050d..97ad8fb80f 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatch.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatch.cs
@@ -33,6 +33,7 @@ namespace System.Text.RegularExpressions
///
/// Represents the results from a single regular expression match.
///
+ [Serializable]
public class Match : Group
{
internal static readonly Match s_empty = new Match(null, 1, string.Empty, 0, 0, 0);
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchCollection.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchCollection.cs
index 7e28d26a3f..9f26b793ee 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchCollection.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchCollection.cs
@@ -22,6 +22,7 @@ namespace System.Text.RegularExpressions
///
[DebuggerDisplay("Count = {Count}")]
[DebuggerTypeProxy(typeof(RegexCollectionDebuggerProxy))]
+ [Serializable]
public class MatchCollection : IList, IReadOnlyList, IList
{
private readonly Regex _regex;
@@ -225,6 +226,7 @@ namespace System.Text.RegularExpressions
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}
+ [Serializable]
private sealed class Enumerator : IEnumerator
{
private readonly MatchCollection _collection;
diff --git a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchTimeoutException.cs b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchTimeoutException.cs
index 5b9e751e6f..107282d88e 100644
--- a/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchTimeoutException.cs
+++ b/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexMatchTimeoutException.cs
@@ -9,6 +9,7 @@ namespace System.Text.RegularExpressions
///
/// This is the exception that is thrown when a RegEx matching timeout occurs.
///
+ [Serializable]
public class RegexMatchTimeoutException : TimeoutException, ISerializable
{
///
diff --git a/src/System.Text.RegularExpressions/tests/Regex.Serialization.cs b/src/System.Text.RegularExpressions/tests/Regex.Serialization.cs
new file mode 100644
index 0000000000..c2fee5d46b
--- /dev/null
+++ b/src/System.Text.RegularExpressions/tests/Regex.Serialization.cs
@@ -0,0 +1,52 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Runtime.Serialization.Formatters.Tests;
+using Xunit;
+
+namespace RegexTests
+{
+ public class SerializationTest
+ {
+ public static IEnumerable
+ [Serializable]
internal class DistributedTransaction : ISerializable, IObjectReference
{
internal DistributedTransaction()
@@ -147,12 +148,14 @@ namespace System.Transactions.Distributed
return new PlatformNotSupportedException(SR.DistributedNotSupported);
}
+ [Serializable]
internal class RealDistributedTransaction
{
internal InternalTransaction InternalTransaction { get; set; }
}
}
+ [Serializable]
internal class DistributedDependentTransaction : DistributedTransaction
{
internal void Complete()
@@ -161,6 +164,7 @@ namespace System.Transactions.Distributed
}
}
+ [Serializable]
internal class DistributedCommittableTransaction : DistributedTransaction
{
internal void BeginCommit(InternalTransaction tx)
diff --git a/src/System.Transactions.Local/src/System/Transactions/SubordinateTransaction.cs b/src/System.Transactions.Local/src/System/Transactions/SubordinateTransaction.cs
index 5fed0b7093..ad16d62e80 100644
--- a/src/System.Transactions.Local/src/System/Transactions/SubordinateTransaction.cs
+++ b/src/System.Transactions.Local/src/System/Transactions/SubordinateTransaction.cs
@@ -5,6 +5,7 @@
namespace System.Transactions
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2229", Justification = "Serialization not yet supported and will be done using DistributedTransaction")]
+ [Serializable]
public sealed class SubordinateTransaction : Transaction
{
// Create a transaction with the given settings
diff --git a/src/System.Transactions.Local/src/System/Transactions/Transaction.cs b/src/System.Transactions.Local/src/System/Transactions/Transaction.cs
index 32b02522f4..170960f1ad 100644
--- a/src/System.Transactions.Local/src/System/Transactions/Transaction.cs
+++ b/src/System.Transactions.Local/src/System/Transactions/Transaction.cs
@@ -53,6 +53,7 @@ namespace System.Transactions
// When we serialize a Transaction, we specify the type DistributedTransaction, so a Transaction never
// actually gets deserialized.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2229", Justification = "Serialization not yet supported and will be done using DistributedTransaction")]
+ [Serializable]
public class Transaction : IDisposable, ISerializable
{
// UseServiceDomain
diff --git a/src/System.Transactions.Local/src/System/Transactions/TransactionException.cs b/src/System.Transactions.Local/src/System/Transactions/TransactionException.cs
index aade4ab5f4..7cd2795043 100644
--- a/src/System.Transactions.Local/src/System/Transactions/TransactionException.cs
+++ b/src/System.Transactions.Local/src/System/Transactions/TransactionException.cs
@@ -10,6 +10,7 @@ namespace System.Transactions
///
/// Summary description for TransactionException.
///
+ [Serializable]
public class TransactionException : SystemException
{
internal static bool IncludeDistributedTxId(Guid distributedTxId)
@@ -172,6 +173,7 @@ namespace System.Transactions
///
/// Summary description for TransactionAbortedException.
///
+ [Serializable]
public class TransactionAbortedException : TransactionException
{
internal static new TransactionAbortedException Create(string message, Exception innerException, Guid distributedTxId)
@@ -247,6 +249,7 @@ namespace System.Transactions
///
/// Summary description for TransactionInDoubtException.
///
+ [Serializable]
public class TransactionInDoubtException : TransactionException
{
internal static new TransactionInDoubtException Create(TraceSourceType traceSource, string message, Exception innerException, Guid distributedTxId)
@@ -307,6 +310,7 @@ namespace System.Transactions
///
/// Summary description for TransactionManagerCommunicationException.
///
+ [Serializable]
public class TransactionManagerCommunicationException : TransactionException
{
internal static new TransactionManagerCommunicationException Create(string message, Exception innerException)
@@ -364,6 +368,7 @@ namespace System.Transactions
}
+ [Serializable]
public class TransactionPromotionException : TransactionException
{
///