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.
Note
- 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
Member | Platforms that throw |
---|---|
CodeDomProvider.CompileAssemblyFromDom | All |
CodeDomProvider.CompileAssemblyFromFile | All |
CodeDomProvider.CompileAssemblyFromSource | All |
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
Member | Platforms that throw |
---|---|
Process.MaxWorkingSet (set only) | Linux |
Process.MinWorkingSet (set only) | Linux |
Process.ProcessorAffinity | macOS |
Process.MainWindowHandle | Linux and macOS |
Process.Start(String, String, String, SecureString, String) | Linux and macOS |
Process.Start(String, String, SecureString, String) | Linux and macOS |
ProcessStartInfo.UserName | Linux and macOS |
ProcessStartInfo.PasswordInClearText | Linux and macOS |
ProcessStartInfo.Domain | Linux and macOS |
ProcessStartInfo.LoadUserProfile | Linux and macOS |
ProcessThread.BasePriority (set only) | Linux and macOS |
ProcessThread.BasePriority (get only) | macOS |
ProcessThread.ProcessorAffinity (set only) | Linux and macOS |
System.IO
Member | Platforms that throw |
---|---|
FileSystemInfo(SerializationInfo, StreamingContext) | All |
FileSystemInfo.GetObjectData(SerializationInfo, StreamingContext) | All |
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
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
Member | Platforms that throw |
---|---|
IDispatchImplAttribute | All |
Marshal.GetIDispatchForObject(Object) | All |
RuntimeEnvironment.SystemConfigurationFile | All |
RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr(Guid, Guid) | All |
RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid, Guid) | All |
WindowsRuntimeMarshal.StringToHString(String) | Linux and macOS |
WindowsRuntimeMarshal.PtrToStringHString(IntPtr) | Linux and macOS |
WindowsRuntimeMarshal.FreeHString(IntPtr) | Linux and macOS |
System.Runtime.Serialization
Member | Platforms that throw |
---|---|
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream, Object)* | All |
BinaryFormatter.Deserialize(Stream)* | All |
XsdDataContractExporter.Schemas | All |
* .NET 8 and later versions only for all project types except Windows Forms and WPF.
System.Security
System.Security.Claims
System.Security.Cryptography
System.Security.Cryptography.Pkcs
Member | Platforms that throw |
---|---|
CmsSigner(CspParameters) | All |
SignerInfo.ComputeCounterSignature() | All |
System.Security.Cryptography.X509Certificates
Member | Platforms that throw |
---|---|
X509Certificate(SerializationInfo, StreamingContext) | All |
X509Certificate.Import | All |
X509Certificate2(SerializationInfo, StreamingContext) | All |
X509Certificate2.PrivateKey (set only) | All |
System.Security.Authentication.ExtendedProtection
Member | Platforms that throw |
---|---|
ExtendedProtectionPolicy(SerializationInfo, StreamingContext) | All |
System.Security.Policy
Member | Platforms that throw |
---|---|
Hash.GetObjectData(SerializationInfo, StreamingContext) | All |
System.ServiceProcess.ServiceController
Member | Platforms that throw |
---|---|
TimeoutException(SerializationInfo, StreamingContext) | All |
System.Text.RegularExpressions
Member | Platforms that throw |
---|---|
Regex.CompileToAssembly | All |
System.Threading
Member | Platforms that throw |
---|---|
CompressedStack.GetObjectData(SerializationInfo, StreamingContext) | All |
ExecutionContext.GetObjectData(SerializationInfo, StreamingContext) | All |
Thread.Abort | All |
Thread.ResetAbort() | All |
Thread.Resume() | All |
Thread.Suspend() | All |
System.Xml
See also
Tee yhteistyötä kanssamme GitHubissa
Tämän sisällön lähde on GitHubissa, jossa voit myös luoda ja tarkastella ongelmia ja pull-pyyntöjä. Katso lisätietoja osallistujan oppaasta.