二进制序列化Binary serialization

可以将序列化定义为一个将对象状态存储到存储介质的过程。Serialization can be defined as the process of storing the state of an object to a storage medium. 在这个过程中,对象的公共字段和私有字段以及类(包括含有该类的程序集)的名称,将转换成字节流,而字节流接着将写入数据流。During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. 随后对该对象进行反序列化时,将创建原始对象的准确克隆。When the object is subsequently deserialized, an exact clone of the original object is created.

在面向对象的环境中实现序列化机制时,必须多在易用性与灵活性之间做出权衡。When implementing a serialization mechanism in an object-oriented environment, you have to make a number of tradeoffs between ease of use and flexibility. 很大程度上,这个过程可以自动完成,但前提是您对该过程拥有足够的控制权。The process can be automated to a large extent, provided you are given sufficient control over the process. 例如,如果简单的二进制序列化不足,或者可能有特定原因决定需要对类中的哪些字段进行序列化,可能就会出现这种情况。For example, situations may arise where simple binary serialization is not sufficient, or there might be a specific reason to decide which fields in a class need to be serialized. 以下章节验证了随 .NET Framework 一起提供的可靠序列化机制,并强调了根据需要自定义该过程所能使用的一些重要功能。The following sections examine the robust serialization mechanism provided with .NET and highlight a number of important features that allow you to customize the process to meet your needs.

备注

如果使用不同的 .NET Framework 版本序列化和反序列化以 UTF-8 或 UTF-7 编码的对象,则不保留该对象的状态。The state of a UTF-8 or UTF-7 encoded object is not preserved if the object is serialized and deserialized using different .NET Framework versions.

警告

二进制序列化可能会十分危险。Binary serialization can be dangerous. 请不要从不受信任的源反序列化数据,也不要将序列化数据往返到不受控制的系统。Never deserialize data from an untrusted source and never round-trip serialized data to systems not under your control.

二进制序列化允许修改对象内部的私有成员,从而更改其状态。Binary serialization allows modifying private members inside an object and therefore changing the state of it. 因此,建议采用在公共 API 表面运行的其他序列化框架,例如 System.Text.JsonBecause of this, other serialization frameworks, like System.Text.Json, that operate on the public API surface are recommended.

.NET Core.NET Core

.NET Core 支持类型子集的二进制序列化。.NET Core supports binary serialization for a subset of types. 可在下面的可序列化类型部分查看受支持的类型列表。You can see the list of supported types in the Serializable types section that follows. 列出的类型是完全可以在 .NET Framework 4.5.1 及更高版本之间和 .NET Core 2.0 及更高版本之间进行序列化的。The listed types are guaranteed to be serializable between .NET Framework 4.5.1 and later versions and between .NET Core 2.0 and later versions. 其他 .NET 实现(如 Mono)并未正式得到支持,但应该也能使用。Other .NET implementations, such as Mono, aren't officially supported but should also work.

可序列化类型Serializable types

类型Type 说明Notes
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
Microsoft.CSharp.RuntimeBinder.RuntimeBinderInternalCompilerException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.AccessViolationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.AggregateException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.AppDomainUnloadedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ApplicationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ArgumentException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ArgumentNullException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ArgumentOutOfRangeException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ArithmeticException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Array
System.ArraySegment<T>
System.ArrayTypeMismatchException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Attribute
System.BadImageFormatException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Boolean
System.Byte
System.CannotUnloadAppDomainException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Char
System.Collections.ArrayList
System.Collections.BitArray
System.Collections.Comparer
System.Collections.DictionaryEntry
System.Collections.Generic.Comparer<T>
System.Collections.Generic.Dictionary<TKey,TValue>
System.Collections.Generic.EqualityComparer<T>
System.Collections.Generic.HashSet<T>
System.Collections.Generic.KeyNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Collections.Generic.KeyValuePair<TKey,TValue>
System.Collections.Generic.LinkedList<T>
System.Collections.Generic.List<T>
System.Collections.Generic.Queue<T>
System.Collections.Generic.SortedDictionary<TKey,TValue>
System.Collections.Generic.SortedList<TKey,TValue>
System.Collections.Generic.SortedSet<T>
System.Collections.Generic.Stack<T>
System.Collections.Hashtable
System.Collections.ObjectModel.Collection<T>
System.Collections.ObjectModel.KeyedCollection<TKey,TItem>
System.Collections.ObjectModel.ObservableCollection<T>
System.Collections.ObjectModel.ReadOnlyCollection<T>
System.Collections.ObjectModel.ReadOnlyDictionary<TKey,TValue>
System.Collections.ObjectModel.ReadOnlyObservableCollection<T>
System.Collections.Queue
System.Collections.SortedList
System.Collections.Specialized.HybridDictionary
System.Collections.Specialized.ListDictionary
System.Collections.Specialized.OrderedDictionary
System.Collections.Specialized.StringCollection
System.Collections.Specialized.StringDictionary
System.Collections.Stack
System.Collections.Generic.NonRandomizedStringEqualityComparer 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ComponentModel.BindingList<T>
System.ComponentModel.DataAnnotations.ValidationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ComponentModel.Design.CheckoutException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ComponentModel.InvalidAsynchronousStateException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ComponentModel.InvalidEnumArgumentException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ComponentModel.LicenseException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
不支持从 .NET Framework 到 .NET Core 的序列化。Serialization from .NET Framework to .NET Core is not supported.
System.ComponentModel.WarningException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ComponentModel.Win32Exception 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Configuration.ConfigurationErrorsException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Configuration.ConfigurationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Configuration.Provider.ProviderException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Configuration.SettingsPropertyIsReadOnlyException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Configuration.SettingsPropertyNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Configuration.SettingsPropertyWrongTypeException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ContextMarshalException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DBNull 从 .NET Core 2.0.2 和更高版本开始。Starting in .NET Core 2.0.2 and later versions.
System.Data.Common.DbException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.ConstraintException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.DBConcurrencyException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.DataException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.DataSet
System.Data.DataTable 如果将 RemotingFormat 设置为 SerializationFormat.Binary,则只能与 .NET Core 2.1 和更高版本进行交换。If you set RemotingFormat to SerializationFormat.Binary, it can only be exchanged with .NET Core 2.1 and later versions.
System.Data.DeletedRowInaccessibleException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.DuplicateNameException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.EvaluateException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.InRowChangingEventException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.InvalidConstraintException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.InvalidExpressionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.MissingPrimaryKeyException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.NoNullAllowedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.Odbc.OdbcException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.OperationAbortedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.PropertyCollection
System.Data.ReadOnlyException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.RowNotInTableException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.SqlClient.SqlException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
不支持从 .NET Framework 到 .NET Core 的序列化Serialization from .NET Framework to .NET Core is not supported
System.Data.SqlTypes.SqlAlreadyFilledException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.SqlTypes.SqlBoolean
System.Data.SqlTypes.SqlByte
System.Data.SqlTypes.SqlDateTime
System.Data.SqlTypes.SqlDouble
System.Data.SqlTypes.SqlGuid
System.Data.SqlTypes.SqlInt16
System.Data.SqlTypes.SqlInt32
System.Data.SqlTypes.SqlInt64
System.Data.SqlTypes.SqlNotFilledException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.SqlTypes.SqlNullValueException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.SqlTypes.SqlString
System.Data.SqlTypes.SqlTruncateException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.SqlTypes.SqlTypeException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.StrongTypingException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.SyntaxErrorException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Data.VersionNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DataMisalignedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DateTime
System.DateTimeOffset
System.Decimal
System.Diagnostics.Contracts.ContractException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Diagnostics.Tracing.EventSourceException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.DirectoryNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.MultipleMatchesException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.NoMatchingPrincipalException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.PasswordException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.PrincipalException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.PrincipalExistsException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.PrincipalOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.AccountManagement.PrincipalServerDownException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectExistsException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.ActiveDirectory.ActiveDirectoryServerDownException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.ActiveDirectory.ForestTrustCollisionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.ActiveDirectory.SyncFromAllServersOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.DirectoryServicesCOMException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.Protocols.BerConversionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.Protocols.DirectoryException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.Protocols.DirectoryOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.Protocols.LdapException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DirectoryServices.Protocols.TlsOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DivideByZeroException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.DllNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Double
System.Drawing.Color
System.Drawing.Point
System.Drawing.PointF
System.Drawing.Rectangle
System.Drawing.RectangleF
System.Drawing.Size
System.Drawing.SizeF
System.DuplicateWaitObjectException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.EntryPointNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Enum
System.EventArgs 从 .NET Core 2.0.6 开始。Starting in .NET Core 2.0.6.
System.Exception
System.ExecutionEngineException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.FieldAccessException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.FormatException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Globalization.CompareInfo
System.Globalization.CultureNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Globalization.SortVersion
System.Guid
System.IO.Compression.ZLibException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.DriveNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.EndOfStreamException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.FileFormatException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.FileLoadException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.FileNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.IOException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.InternalBufferOverflowException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.InvalidDataException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.IsolatedStorage.IsolatedStorageException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IO.PathTooLongException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.IndexOutOfRangeException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.InsufficientExecutionStackException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.InsufficientMemoryException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Int16
System.Int32
System.Int64
System.IntPtr
System.InvalidCastException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.InvalidOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.InvalidProgramException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.InvalidTimeZoneException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.MemberAccessException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.MethodAccessException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.MissingFieldException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.MissingMemberException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.MissingMethodException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.MulticastNotSupportedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.Cookie
System.Net.CookieCollection
System.Net.CookieContainer
System.Net.CookieException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.HttpListenerException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.Mail.SmtpException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.Mail.SmtpFailedRecipientException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.Mail.SmtpFailedRecipientsException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.NetworkInformation.NetworkInformationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.NetworkInformation.PingException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.ProtocolViolationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.Sockets.SocketException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.WebException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Net.WebSockets.WebSocketException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.NotFiniteNumberException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.NotImplementedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.NotSupportedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.NullReferenceException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Nullable<T>
System.Numerics.BigInteger
System.Numerics.Complex
System.Object
System.ObjectDisposedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.OperationCanceledException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.OutOfMemoryException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.OverflowException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.PlatformNotSupportedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.RankException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Reflection.AmbiguousMatchException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Reflection.CustomAttributeFormatException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Reflection.InvalidFilterCriteriaException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Reflection.ReflectionTypeLoadException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
不支持从 .NET Framework 到 .NET Core 的序列化。Serialization from .NET Framework to .NET Core is not supported.
System.Reflection.TargetException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Reflection.TargetInvocationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Reflection.TargetParameterCountException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Resources.MissingManifestResourceException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Resources.MissingSatelliteAssemblyException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.CompilerServices.RuntimeWrappedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.COMException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.ExternalException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.InvalidComObjectException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.InvalidOleVariantTypeException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.MarshalDirectiveException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.SEHException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.SafeArrayRankMismatchException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.InteropServices.SafeArrayTypeMismatchException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.Serialization.InvalidDataContractException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Runtime.Serialization.SerializationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.SByte
System.Security.AccessControl.PrivilegeNotHeldException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Authentication.AuthenticationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Authentication.InvalidCredentialException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Cryptography.CryptographicException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Cryptography.CryptographicUnexpectedOperationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Cryptography.Xml.CryptoSignedXmlRecursionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.HostProtectionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Policy.PolicyException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.Principal.IdentityNotMappedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.SecurityException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
有限的序列化数据。Limited serialization data.
System.Security.VerificationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Security.XmlSyntaxException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ServiceProcess.TimeoutException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Single
System.StackOverflowException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.String
System.StringComparer
System.SystemException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Text.DecoderFallbackException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Text.EncoderFallbackException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Text.RegularExpressions.RegexMatchTimeoutException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Text.StringBuilder
System.Threading.AbandonedMutexException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.BarrierPostPhaseException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.LockRecursionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.SemaphoreFullException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.SynchronizationLockException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.Tasks.TaskCanceledException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.Tasks.TaskSchedulerException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.ThreadAbortException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.ThreadInterruptedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.ThreadStartException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.ThreadStateException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Threading.WaitHandleCannotBeOpenedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.TimeSpan
System.TimeZoneInfo.AdjustmentRule
System.TimeZoneInfo
System.TimeZoneNotFoundException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.TimeoutException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Transactions.TransactionAbortedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Transactions.TransactionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Transactions.TransactionInDoubtException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Transactions.TransactionManagerCommunicationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Transactions.TransactionPromotionException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Tuple
System.TypeAccessException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.TypeInitializationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.TypeLoadException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.TypeUnloadedException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.UInt16
System.UInt32
System.UInt64
System.UIntPtr
System.UnauthorizedAccessException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Uri
System.UriFormatException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.ValueTuple 在 .NET Framework 4.7 及早期版本中不可序列化。Not serializable in .NET Framework 4.7 and earlier versions.
System.ValueType
System.Version
System.WeakReference<T>
System.WeakReference
System.Xml.Schema.XmlSchemaException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Xml.Schema.XmlSchemaInferenceException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Xml.Schema.XmlSchemaValidationException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Xml.XPath.XPathException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Xml.XmlException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Xml.Xsl.XsltCompileException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.
System.Xml.Xsl.XsltException 从 .NET Core 2.0.4 开始。Starting in .NET Core 2.0.4.

请参阅See also