อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


APIs that always throw exceptions on .NET Core and .NET 5+

The following APIs will always throw an exception on .NET (Core) on all or a subset of platforms. In most cases, the exception that's thrown is PlatformNotSupportedException.

This article organizes the affected APIs by namespace.

หมายเหตุ

  • This article is a work-in-progress. It is not a complete list of APIs that throw exceptions on .NET 5+.
  • This article does not include the explicit interface implementations for binary serialization that throw on .NET 5+. For more information, see Binary serialization in .NET Core.

System

System.CodeDom.Compiler

System.Collections.Specialized

System.Configuration

Member Platforms that throw
System.Configuration.RsaProtectedConfigurationProvider (all members) All

System.Console

Member Platforms that throw
Console.Beep() Linux and macOS
Console.BufferHeight (set only) Linux and macOS
Console.BufferWidth (set only) Linux and macOS
Console.CursorSize (set only) Linux and macOS
Console.CursorVisible (get only) Linux and macOS
Console.MoveBufferArea Linux and macOS
Console.SetWindowPosition Linux and macOS
Console.SetWindowSize Linux and macOS
Console.Title (get only) Linux and macOS
Console.WindowHeight (set only) Linux and macOS
Console.WindowLeft (set only) Linux and macOS
Console.WindowTop (set only) Linux and macOS
Console.WindowWidth (set only) Linux and macOS

System.Data.Common

Member Platforms that throw
DbDataReader.GetSchemaTable (throws NotSupportedException) All

System.Diagnostics.Process

System.IO

System.IO.Pipes

Member Platforms that throw
NamedPipeClientStream.NumberOfServerInstances Linux and macOS
NamedPipeServerStream.GetImpersonationUserName() Linux and macOS
PipeStream.InBufferSize Linux and macOS
PipeStream.OutBufferSize Linux and macOS
PipeStream.ReadMode (set only) Linux and macOS
PipeStream.WaitForPipeDrain() Linux and macOS

System.Media

Member Platforms that throw
SoundPlayer(SerializationInfo, StreamingContext) All

System.Net

* .NET 9 and later versions.

System.Net.NetworkInformation

Member Platforms that throw
Ping.Send Windows (UWP)

System.Net.Sockets

Member Platforms that throw
Socket(SocketInformation) All
Socket.DuplicateAndClose(Int32) All

System.Net.WebSockets

Member Platforms that throw
WebSocket.RegisterPrefixes() All

System.Reflection

System.Runtime.CompilerServices

Member Platforms that throw
DebugInfoGenerator.CreatePdbGenerator() All

System.Runtime.InteropServices

System.Runtime.Serialization

* .NET 9 and later versions. † .NET 8 only for all project types except Windows Forms and WPF.

System.Security

System.Security.Claims

System.Security.Cryptography

Member Platforms that throw
AsymmetricAlgorithm.Create(String) All
System.Security.Cryptography.CngAlgorithm Linux and macOS
System.Security.Cryptography.CngAlgorithmGroup Linux and macOS
System.Security.Cryptography.CngKey Linux and macOS
System.Security.Cryptography.CngKeyBlobFormat Linux and macOS
System.Security.Cryptography.CngKeyCreationParameters Linux and macOS
System.Security.Cryptography.CngProvider Linux and macOS
System.Security.Cryptography.CngUIPolicy Linux and macOS
CryptoConfig.EncodeOID(String) All
CspKeyContainerInfo Linux and macOS
CspKeyContainerInfo.Accessible Linux and macOS
CspKeyContainerInfo.Exportable Linux and macOS
CspKeyContainerInfo.HardwareDevice Linux and macOS
CspKeyContainerInfo.KeyContainerName Linux and macOS
CspKeyContainerInfo.KeyNumber Linux and macOS
CspKeyContainerInfo.MachineKeyStore Linux and macOS
CspKeyContainerInfo.Protected Linux and macOS
CspKeyContainerInfo.ProviderName Linux and macOS
CspKeyContainerInfo.ProviderType Linux and macOS
CspKeyContainerInfo.RandomlyGenerated Linux and macOS
CspKeyContainerInfo.Removable Linux and macOS
CspKeyContainerInfo.UniqueKeyContainerName Linux and macOS
ECDiffieHellmanCng.FromXmlString(String, ECKeyXmlFormat) All
ECDiffieHellmanCng.ToXmlString(ECKeyXmlFormat) All
ECDiffieHellmanCngPublicKey.FromXmlString(String) All
ECDiffieHellmanCngPublicKey.ToXmlString() All
ECDiffieHellmanPublicKey.ToByteArray() Linux and macOS
ECDiffieHellmanPublicKey.ToXmlString() All
ECDsaCng.FromXmlString(String, ECKeyXmlFormat) All
ECDsaCng.ToXmlString(ECKeyXmlFormat) All
HashAlgorithm.Create() All
HMAC.Create() All
HMAC.Create(String) All
HMAC.HashCore All
HMAC.HashFinal All
HMAC.Initialize All
KeyedHashAlgorithm.Create() All
KeyedHashAlgorithm.Create(String) All
ProtectedData.Protect Linux and macOS
ProtectedData.Unprotect Linux and macOS
System.Security.Cryptography.RSACryptoServiceProvider.DecryptValue(Byte[]) All
System.Security.Cryptography.RSACryptoServiceProvider.EncryptValue(Byte[]) All
System.Security.Cryptography.RSA.DecryptValue(Byte[]) All
System.Security.Cryptography.RSA.EncryptValue(Byte[]) All
RSA.FromXmlString All
RSA.ToXmlString All
SymmetricAlgorithm.Create() All
SymmetricAlgorithm.Create(String) All

System.Security.Cryptography.Pkcs

System.Security.Cryptography.X509Certificates

System.Security.Authentication.ExtendedProtection

System.Security.Policy

System.ServiceProcess.ServiceController

System.Text.RegularExpressions

Member Platforms that throw
Regex.CompileToAssembly All

System.Threading

System.Xml

See also