Per https://github.com/dotnet/designs/blob/master/accepted/2020/better-obsoletion/better-obsoletion.md, we now have a strategy for marking existing APIs as [Obsolete]
. This takes advantage of the new diagnostic id and URL template mechanisms introduced to ObsoleteAttribute
in .NET 5.
The diagnostic id values reserved for obsoletions are SYSLIB0001
through SYSLIB0999
. When obsoleting an API, claim the next three-digit identifier in the SYSLIB0###
sequence and add it to the list below. The URL template for all obsoletions is https://aka.ms/dotnet-warnings/{0}
. The {0}
placeholder is replaced by the compiler with the SYSLIB0###
identifier.
The acceptance criteria for adding an obsoletion includes:
- Add the obsoletion to the table below, claiming the next diagnostic id
- Ensure the description is meaningful within the context of this table, and without requiring the context of the calling code
- Add new constants to
src\libraries\Common\src\System\Obsoletions.cs
, following the existing conventions- A
...Message
const using the same description added to the table below - A
...DiagId
const for theSYSLIB0###
id
- A
- Annotate
src
files by referring to the constants defined fromObsoletions.cs
- Specify the
UrlFormat = Obsoletions.SharedUrlFormat
- Example:
[Obsolete(Obsoletions.CodeAccessSecurityMessage, DiagnosticId = Obsoletions.CodeAccessSecurityDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
- If the
Obsoletions
type is not available in the project, link it into the project<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" />
- Specify the
- Annotate
ref
files using the hard-coded strings copied fromObsoletions.cs
- This matches our general pattern of
ref
files using hard-coded attribute strings - Example:
[System.ObsoleteAttribute("The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.", DiagnosticId = "SYSLIB0001", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
- This matches our general pattern of
- If the library builds against downlevel targets earlier than .NET 5.0, then add an internal copy of
ObsoleteAttribute
- The compiler recognizes internal implementations of
ObsoleteAttribute
to enable theDiagnosticId
andUrlFormat
properties to light up downlevel - An MSBuild property can be added to the project's first
<PropertyGroup>
to achieve this easily - Example:
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
- This will need to be specified in both the
src
andref
projects
- The compiler recognizes internal implementations of
- If the library contains types that are forwarded within a generated shim
- Errors will be received when running
build libs
, with obsoletion errors insrc/libraries/shims/generated
files - This is resolved by adding the obsoletion's diagnostic id to the
<NoWarn>
property for partial facade assemblies - That property is found in
src/libraries/Directory.Build.targets
- Search for the "Ignore Obsolete errors within the generated shims that type-forward types" comment and add the appropriate diagnostic id to the comment and the
<NoWarn>
property (other SYSLIB diagnostics already exist there)
- Errors will be received when running
- Apply the
breaking-change
label to the PR that introduces the obsoletion- A bot will automatically apply the
needs-breaking-change-doc-created
label when thebreaking-change
label is detected
- A bot will automatically apply the
- Follow up with the breaking change process to communicate and document the breaking change
- In the breaking-change issue filed in dotnet/docs, specifically mention that this breaking change is an obsoletion with a
SYSLIB
diagnostic id - The documentation team will produce a PR that adds the obsoletion to the SYSLIB warnings page
- That PR will also add a new URL specific to this diagnostic ID; e.g. SYSLIB0001
- Connect with
@gewarren
or@BillWagner
with any questions
- In the breaking-change issue filed in dotnet/docs, specifically mention that this breaking change is an obsoletion with a
- Register the
SYSLIB0###
URL inaka.ms
- The vanity name will be
dotnet-warnings/syslib0###
- Ensure the link's group owner matches the group owner of
dotnet-warnings/syslib0001
- Connect with
@jeffhandley
,@GrabYourPitchforks
, or@gewarren
with any questions
- The vanity name will be
An example obsoletion PR that can be referenced where each of the above criteria was met is:
The PR that reveals the implementation of the <IncludeInternalObsoleteAttribute>
property was:
Diagnostic ID | Description |
---|---|
SYSLIB0001 |
The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead. |
SYSLIB0002 |
PrincipalPermissionAttribute is not honored by the runtime and must not be used. |
SYSLIB0003 |
Code Access Security is not supported or honored by the runtime. |
SYSLIB0004 |
The Constrained Execution Region (CER) feature is not supported. |
SYSLIB0005 |
The Global Assembly Cache is not supported. |
SYSLIB0006 |
Thread.Abort is not supported and throws PlatformNotSupportedException. |
SYSLIB0007 |
The default implementation of this cryptography algorithm is not supported. |
SYSLIB0008 |
The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException. |
SYSLIB0009 |
AuthenticationManager is not supported. Methods will no-op or throw PlatformNotSupportedException. |
SYSLIB0010 |
This Remoting API is not supported and throws PlatformNotSupportedException. |
SYSLIB0011 |
BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for recommended alternatives. |
SYSLIB0012 |
Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead. |
SYSLIB0013 |
Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead. |
SYSLIB0014 |
WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead. |
SYSLIB0015 |
DisablePrivateReflectionAttribute has no effect in .NET 6.0+. |
SYSLIB0016 |
Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations. |
SYSLIB0017 |
Strong name signing is not supported and throws PlatformNotSupportedException. |
SYSLIB0018 |
ReflectionOnly loading is not supported and throws PlatformNotSupportedException. |
SYSLIB0019 |
RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException. |
SYSLIB0020 |
JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull. |
SYSLIB0021 |
Derived cryptographic types are obsolete. Use the Create method on the base type instead. |
SYSLIB0022 |
The Rijndael and RijndaelManaged types are obsolete. Use Aes instead. |
SYSLIB0023 |
RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead. |
SYSLIB0024 |
Creating and unloading AppDomains is not supported and throws an exception. |
SYSLIB0025 |
SuppressIldasmAttribute has no effect in .NET 6.0+. |
SYSLIB0026 |
X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate. |
SYSLIB0027 |
PublicKey.Key is obsolete. Use the appropriate method to get the public key, such as GetRSAPublicKey. |
SYSLIB0028 |
X509Certificate2.PrivateKey is obsolete. Use the appropriate method to get the private key, such as GetRSAPrivateKey, or use the CopyWithPrivateKey method to create a new instance with a private key. |
SYSLIB0029 |
ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported. |
SYSLIB0030 |
HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter. |
SYSLIB0031 |
EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1. |
SYSLIB0032 |
Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored. |
SYSLIB0033 |
Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead. |
SYSLIB0034 |
CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead. |
SYSLIB0035 |
ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner. |
SYSLIB0036 |
Regex.CompileToAssembly is obsolete and not supported. Use GeneratedRegexAttribute with the regular expression source generator instead. |
SYSLIB0037 |
AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported. |
SYSLIB0038 |
SerializationFormat.Binary is obsolete and should not be used. See https://aka.ms/serializationformat-binary-obsolete for more information. |
SYSLIB0039 |
TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended. Use a newer TLS version instead, or use SslProtocols.None to defer to OS defaults. |
SYSLIB0040 |
EncryptionPolicy.NoEncryption and AllowEncryption significantly reduce security and should not be used in production code. |
SYSLIB0041 |
The default hash algorithm and iteration counts in Rfc2898DeriveBytes constructors are outdated and insecure. Use a constructor that accepts the hash algorithm and the number of iterations. |
SYSLIB0042 |
ToXmlString and FromXmlString have no implementation for ECC types, and are obsolete. Use a standard import and export format such as ExportSubjectPublicKeyInfo or ImportSubjectPublicKeyInfo for public keys and ExportPkcs8PrivateKey or ImportPkcs8PrivateKey for private keys. |
SYSLIB0043 |
ECDiffieHellmanPublicKey.ToByteArray() and the associated constructor do not have a consistent and interoperable implementation on all platforms. Use ECDiffieHellmanPublicKey.ExportSubjectPublicKeyInfo() instead. |
SYSLIB0044 |
AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported. |
SYSLIB0045 |
Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead. |
SYSLIB0046 |
ControlledExecution.Run method may corrupt the process and should not be used in production code. |
SYSLIB0047 |
XmlSecureResolver is obsolete. Use XmlResolver.ThrowingResolver instead when attempting to forbid XML external entity resolution. |
SYSLIB0048 |
RSA.EncryptValue and DecryptValue are not supported and throw NotSupportedException. Use RSA.Encrypt and RSA.Decrypt instead. |
SYSLIB0049 |
JsonSerializerOptions.AddContext is obsolete. To register a JsonSerializerContext, use either the TypeInfoResolver or TypeInfoResolverChain properties. |
SYSLIB0050 |
Formatter-based serialization is obsolete and should not be used. |
SYSLIB0051 |
This API supports obsolete formatter-based serialization. It should not be called or extended by application code. |
SYSLIB0052 |
This API supports obsolete mechanisms for Regex extensibility. It is not supported. |
SYSLIB0053 |
AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size. |
SYSLIB0054 |
Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead. |
SYSLIB0055 |
The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead. |
SYSLIB0056 |
LoadFrom with a custom AssemblyHashAlgorithm is obsolete. Use overloads without an AssemblyHashAlgorithm. |
SYSLIB0057 |
Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates. |
SYSLIB0058 |
KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherAlgorithmStrength, HashAlgorithm and HashStrength properties of SslStream are obsolete. Use NegotiatedCipherSuite instead. |
The diagnostic id values reserved for .NET Libraries analyzer warnings are SYSLIB1001
through SYSLIB1999
. When creating a new analyzer that ships as part of the Libraries (and not part of the SDK), claim the next three-digit identifier in the SYSLIB1###
sequence and add it to the list below.
Diagnostic ID | Description |
---|---|
SYSLIB1001 |
Logging method names cannot start with _ |
SYSLIB1002 |
Don't include log level parameters as templates in the logging message |
SYSLIB1003 |
InvalidLoggingMethodParameterNameTitle |
SYSLIB1004 |
Logging class cannot be in nested types |
SYSLIB1005 |
Could not find a required type definition |
SYSLIB1006 |
Multiple logging methods cannot use the same event id within a class |
SYSLIB1007 |
Logging methods must return void |
SYSLIB1008 |
One of the arguments to a logging method must implement the Microsoft.Extensions.Logging.ILogger interface |
SYSLIB1009 |
Logging methods must be static |
SYSLIB1010 |
Logging methods must be partial |
SYSLIB1011 |
Logging methods cannot be generic |
SYSLIB1012 |
Redundant qualifier in logging message |
SYSLIB1013 |
Don't include exception parameters as templates in the logging message |
SYSLIB1014 |
Logging template has no corresponding method argument |
SYSLIB1015 |
Argument is not referenced from the logging message |
SYSLIB1016 |
Logging methods cannot have a body |
SYSLIB1017 |
A LogLevel value must be supplied in the LoggerMessage attribute or as a parameter to the logging method |
SYSLIB1018 |
Don't include logger parameters as templates in the logging message |
SYSLIB1019 |
Couldn't find a field of type Microsoft.Extensions.Logging.ILogger |
SYSLIB1020 |
Found multiple fields of type Microsoft.Extensions.Logging.ILogger |
SYSLIB1021 |
Can't have the same template with different casing |
SYSLIB1022 |
Logging method contains malformed format strings |
SYSLIB1023 |
Generating more than 6 arguments is not supported |
SYSLIB1024 |
Argument is using the unsupported out parameter modifier |
SYSLIB1025 |
Multiple logging methods cannot use the same event name within a class |
SYSLIB1026 |
C# language version not supported by the logging source generator. |
SYSLIB1027 |
Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field |
SYSLIB1028 |
SYSLIB1001 -SYSLIB1029 reserved for logging. |
SYSLIB1029 |
SYSLIB1001 -SYSLIB1029 reserved for logging. |
SYSLIB1030 |
JsonSourceGenerator did not generate serialization metadata for type |
SYSLIB1031 |
JsonSourceGenerator encountered a duplicate JsonTypeInfo property name |
SYSLIB1032 |
JsonSourceGenerator encountered a context class that is not partial |
SYSLIB1033 |
JsonSourceGenerator encountered a type that has multiple [JsonConstructor] annotations |
SYSLIB1034 |
JsonSourceGenerator encountered a [JsonStringEnumConverter] annotation |
SYSLIB1035 |
JsonSourceGenerator encountered a type that has multiple [JsonExtensionData] annotations |
SYSLIB1036 |
JsonSourceGenerator encountered an invalid [JsonExtensionData] annotation |
SYSLIB1037 |
JsonSourceGenerator encountered a type with init-only properties for which deserialization is not supported |
SYSLIB1038 |
JsonSourceGenerator encountered a property annotated with [JsonInclude] that has inaccessible accessors |
SYSLIB1039 |
JsonSourceGenerator encountered a [JsonDerivedTypeAttribute] annotation with [JsonSourceGenerationMode.Serialization] enabled |
SYSLIB1040 |
Invalid GeneratedRegex attribute |
SYSLIB1041 |
Multiple GeneratedRegex attribute |
SYSLIB1042 |
Invalid GeneratedRegex arguments |
SYSLIB1043 |
GeneratedRegex method must have a valid signature |
SYSLIB1044 |
GeneratedRegex only supports C# 11 and newer |
SYSLIB1045 |
Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time |
SYSLIB1046 |
SYSLIB1045 -SYSLIB1049 reserved for System.Text.RegularExpressions.Generator. |
SYSLIB1047 |
SYSLIB1045 -SYSLIB1049 reserved for System.Text.RegularExpressions.Generator. |
SYSLIB1048 |
SYSLIB1045 -SYSLIB1049 reserved for System.Text.RegularExpressions.Generator. |
SYSLIB1049 |
SYSLIB1045 -SYSLIB1049 reserved for System.Text.RegularExpressions.Generator. |
SYSLIB1050 |
Invalid LibraryImportAttribute usage |
SYSLIB1051 |
Specified type is not supported by source-generated P/Invokes |
SYSLIB1052 |
Specified configuration is not supported by source-generated P/Invokes |
SYSLIB1053 |
Specified LibraryImportAttribute arguments cannot be forwarded to DllImportAttribute |
SYSLIB1054 |
Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time |
SYSLIB1055 |
Invalid CustomMarshallerAttribute usage |
SYSLIB1056 |
Specified native type is invalid |
SYSLIB1057 |
Marshaller type does not have the required shape |
SYSLIB1058 |
Invalid NativeMarshallingAttribute usage |
SYSLIB1059 |
Marshaller type does not support allocating constructor |
SYSLIB1060 |
Specified marshaller type is invalid |
SYSLIB1061 |
Marshaller type has incompatible method signatures |
SYSLIB1062 |
Project must be updated with 'true' |
SYSLIB1063 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1064 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1065 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1066 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1067 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1068 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1069 |
SYSLIB1063 -SYSLIB1069 reserved for Microsoft.Interop.LibraryImportGenerator. |
SYSLIB1070 |
Invalid 'JSImportAttribute' usage |
SYSLIB1071 |
Invalid 'JSExportAttribute' usage |
SYSLIB1072 |
Specified type is not supported by source-generated JavaScript interop |
SYSLIB1073 |
Specified configuration is not supported by source-generated JavaScript interop |
SYSLIB1074 |
JSImportAttribute requires unsafe code |
SYSLIB1075 |
JSExportAttribute requires unsafe code |
SYSLIB1076 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1077 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1078 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1079 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1080 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1081 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1082 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1083 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1084 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1085 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1086 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1087 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1088 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1089 |
SYSLIB1070 -SYSLIB1089 reserved for System.Runtime.InteropServices.JavaScript.JSImportGenerator. |
SYSLIB1090 |
Invalid 'GeneratedComInterfaceAttribute' usage |
SYSLIB1091 |
Method is declared in different partial declaration than the 'GeneratedComInterface' attribute. |
SYSLIB1092 |
Usage of '[LibraryImport |
SYSLIB1093 |
Analysis for COM interface generation has failed |
SYSLIB1094 |
The base COM interface failed to generate source. Code will not be generated for this interface. |
SYSLIB1095 |
Invalid 'GeneratedComClassAttribute' usage |
SYSLIB1096 |
Use 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time |
SYSLIB1097 |
This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. |
SYSLIB1098 |
.NET COM hosting with 'EnableComHosting' only supports built-in COM interop. It does not support source-generated COM interop with 'GeneratedComInterfaceAttribute'. |
SYSLIB1099 |
COM Interop APIs on 'System.Runtime.InteropServices.Marshal' do not support source-generated COM and will fail at runtime |
SYSLIB1100 |
Configuration binding generator: type is not supported. |
SYSLIB1101 |
Configuration binding generator: property on type is not supported. |
SYSLIB1102 |
Configuration binding generator: project's language version must be at least C# 12. |
SYSLIB1103 |
Configuration binding generator: value types are invalid inputs to configuration 'Bind' methods.* |
SYSLIB1104 |
Configuration binding generator: Generator cannot determine the target configuration type.* |
SYSLIB1105 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1106 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1107 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1108 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1109 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1110 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1111 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1112 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1113 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1114 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1115 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1116 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1117 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1118 |
SYSLIB1100 -SYSLIB1118 reserved for Microsoft.Extensions.Configuration.Binder.SourceGeneration. |
SYSLIB1201 |
Options validation generator: Can't use 'ValidateObjectMembersAttribute' or ValidateEnumeratedItemsAttribute on fields or properties with open generic types. |
SYSLIB1202 |
Options validation generator: A member type has no fields or properties to validate. |
SYSLIB1203 |
Options validation generator: A type has no fields or properties to validate. |
SYSLIB1204 |
Options validation generator: A type annotated with OptionsValidatorAttribute doesn't implement the necessary interface. |
SYSLIB1205 |
Options validation generator: A type already includes an implementation of the 'Validate' method. |
SYSLIB1206 |
Options validation generator: Can't validate private fields or properties. |
SYSLIB1207 |
Options validation generator: Member type is not enumerable. |
SYSLIB1208 |
Options validation generator: Validators used for transitive or enumerable validation must have a constructor with no parameters. |
SYSLIB1209 |
Options validation generator: OptionsValidatorAttribute can't be applied to a static class. |
SYSLIB1210 |
Options validation generator: Null validator type specified for the ValidateObjectMembersAttribute or 'ValidateEnumeratedItemsAttribute' attributes. |
SYSLIB1211 |
Options validation generator: Unsupported circular references in model types. |
SYSLIB1212 |
Options validation generator: Member potentially missing transitive validation. |
SYSLIB1213 |
Options validation generator: Member potentially missing enumerable validation. |
SYSLIB1214 |
Options validation generator: Can't validate constants, static fields or properties. |
SYSLIB1215 |
Options validation generator: Validation attribute on the member is inaccessible from the validator type. |
SYSLIB1216 |
C# language version not supported by the options validation source generator. |
SYSLIB1217 |
The validation attribute is only applicable to properties of type string, array, or ICollection; it cannot be used with other types. |
SYSLIB1218 |
SYSLIB1201 -SYSLIB1219 reserved for Microsoft.Extensions.Options.SourceGeneration. |
SYSLIB1219 |
SYSLIB1201 -SYSLIB1219 reserved for Microsoft.Extensions.Options.SourceGeneration. |
SYSLIB1220 |
JsonSourceGenerator encountered a [JsonConverterAttribute] with an invalid type argument. |
SYSLIB1221 |
JsonSourceGenerator does not support this C# language version. |
SYSLIB1222 |
Constructor annotated with JsonConstructorAttribute is inaccessible. |
SYSLIB1223 |
Attributes deriving from JsonConverterAttribute are not supported by the source generator. |
SYSLIB1224 |
Types annotated with JsonSerializableAttribute must be classes deriving from JsonSerializerContext. |
SYSLIB1225 |
Type includes ref like property, field or constructor parameter. |
SYSLIB1226 |
SYSLIB1220 -SYSLIB1229 reserved for System.Text.Json.SourceGeneration. |
SYSLIB1227 |
SYSLIB1220 -SYSLIB1229 reserved for System.Text.Json.SourceGeneration. |
SYSLIB1228 |
SYSLIB1220 -SYSLIB1229 reserved for System.Text.Json.SourceGeneration. |
SYSLIB1229 |
SYSLIB1220 -SYSLIB1229 reserved for System.Text.Json.SourceGeneration. |
SYSLIB1230 |
Deriving from a GeneratedComInterface -attributed interface defined in another assembly is not supported. |
SYSLIB1231 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1232 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1233 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1234 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1235 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1236 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1237 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1238 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
SYSLIB1239 |
SYSLIB1230 -SYSLIB1239 reserved for Microsoft.Interop.ComInterfaceGenerator. |
Suppression ID | Suppressed Diagnostic ID | Description |
---|---|---|
SYSLIBSUPPRESS0001 |
CA1822 | Do not offer to make methods static when the methods need to be instance methods for a custom marshaller shape. |
SYSLIBSUPPRESS0002 |
IL2026 | ConfigurationBindingGenerator: suppress RequiresUnreferencedCode diagnostic for binding call that has been intercepted by a generated static variant. |
SYSLIBSUPPRESS0003 |
IL3050 | ConfigurationBindingGenerator: suppress RequiresDynamicCode diagnostic for binding call that has been intercepted by a generated static variant. |
APIs can be marked as [Experimental]
if their shape or functionality is included in a release but not yet officially supported. Experimental APIs offer the opportunity to collect customer feedback on these APIs in a major release, usually refining the APIs and removing the [Experimental]
attribute in the next release. The [Experimental]
attribute differs from [RequiresPreviewFeatures]
, wherein:
[RequiresPreviewFeatures]
APIs require a corresponding preview feature in another product area such as the compiler or SDK- Using these APIs requires enabling preview features for the the project and all its consumers
[Experimental]
APIs are self-contained within the libraries and do not require preview features in other parts of the product- These APIs can be used by suppressing specific diagnostics without enabling preview features for the project
See Preview APIs - .NET | Microsoft Learn for more information.
The diagnostic id values reserved for experimental APIs are SYSLIB5001
through SYSLIB5999
. When marking an API as [Experimental]
, claim the next three-digit identifier in the SYSLIB5###
sequence and add it to the list below. The URL template for all experimental APIs is https://aka.ms/dotnet-warnings/{0}
. The {0}
placeholder is replaced by the compiler with the SYSLIB5###
identifier.
Diagnostic id values for experimental APIs must not be recycled, as that could silently opt customers into new experimental APIs where they had previously suppressed the ID for a previous usage of the value.
Diagnostic ID | Introduced | Removed | Description |
---|---|---|---|
SYSLIB5001 |
.NET 9 | TBD | Tensor<T> and related APIs in System.Numerics.Tensors are experimental |
SYSLIB5002 |
.NET 9 | TBD | SystemColors alternate colors are experimental |
SYSLIB5003 |
.NET 9 | TBD | System.Runtime.Intrinsics.Arm.Sve is experimental |
SYSLIB5004 |
.NET 9 | TBD | X86Base.DivRem is experimental since performance is not as optimized as T.DivRem |
SYSLIB5005 |
.NET 9 | TBD | System.Formats.Nrbf is experimental |