Description
Upgraded System.Security.Cryptography.Xml v5.0.0 to v7.0.0 in a .NET 4.8 project, and now when I try to access the EncryptedData class, I get the following error:
System.TypeLoadException: Could not load type 'System.Security.Cryptography.Xml.EncryptedData' from assembly 'System.Security.Cryptography.Xml, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Issue_System.Security.Cryptography.Xml.zip
Reproduction Steps
- Open Visual Studio 2022
- Create a .NET 4.8 console app.
- Add a .NET Standard 2.0 class library
- In the library:
- Reference the
System.Security.Cryptography.Xml NuGet package v7.0.0.0 (this also occurs in 6.0.0.1, FWIW).
- Create a public class with a single method.
- In the method, new up an instance of
EncryptedData
- In the console app:
- Ensure the
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> line is added to the .csproj file so you don't have to reference the NuGet package explicitly here.
- Reference the class library, above.
- In Main, new up an instance of the test class, above, and attempt to invoke the single method.
Expected behavior
Should not throw.
Actual behavior
I get the error mentioned in the description, above.

Regression?
This works fine when using System.Security.Encryption.Xml v6.0.1 or lower. As soon as you update to v7.0.0, BLAM.
Known Workarounds
Use v6.0.1 for now. The vulnerability appears to have been patched, but you don't get the v7.0.0 benefits (if there are any).
Configuration
- Console app is running on .NET 4.8
- Class library referencing the package is against .NET Standard 2.0
- Windows 10 Enterprise Version 21H2 (OS Build 19044.2251)
- Architecture is x64
- This has been reproduced on 2 separate machines running (roughly) the same configuration.
Other information
When looking at the .dll file using ILSpy or dotPeek, the EncryptedData class does not seem to be there at all.
Description
Upgraded System.Security.Cryptography.Xml v5.0.0 to v7.0.0 in a .NET 4.8 project, and now when I try to access the
EncryptedDataclass, I get the following error:Issue_System.Security.Cryptography.Xml.zip
Reproduction Steps
System.Security.Cryptography.XmlNuGet package v7.0.0.0 (this also occurs in 6.0.0.1, FWIW).EncryptedData<RestoreProjectStyle>PackageReference</RestoreProjectStyle>line is added to the .csproj file so you don't have to reference the NuGet package explicitly here.Expected behavior
Should not throw.
Actual behavior
I get the error mentioned in the description, above.

Regression?
This works fine when using System.Security.Encryption.Xml v6.0.1 or lower. As soon as you update to v7.0.0, BLAM.
Known Workarounds
Use v6.0.1 for now. The vulnerability appears to have been patched, but you don't get the v7.0.0 benefits (if there are any).
Configuration
Other information
When looking at the .dll file using ILSpy or dotPeek, the EncryptedData class does not seem to be there at all.