SYSLIB0022: The Rijndael and RijndaelManaged types are obsolete

The Rijndael and RijndaelManaged types are marked as obsolete, starting in .NET 6. Using them in code generates warning SYSLIB0022 at compile time.


Use System.Security.Cryptography.Aes instead.

Suppress a warning

If you must use the obsolete APIs, you can suppress the warning in code or in your project file.

To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.

// Disable the warning.
#pragma warning disable SYSLIB0022

// Code that uses obsolete API.
// ...

// Re-enable the warning.
#pragma warning restore SYSLIB0022

To suppress all the SYSLIB0022 warnings in your project, add a <NoWarn> property to your project file.

<Project Sdk="Microsoft.NET.Sdk">

For more information, see Suppress warnings.