.netxmlcryptography.net-standard-2.0system.security

Why is System.Security.Cryptography.Xml not part of .NET Standard 2.0?


I am a little confused by the fact that almost all types from the namespace System.Security.Cryptography are part of .NET Standard 2.0, but for System.Security.Cryptography.Xml one needs to take a dependency on the extension package by the same name.

Can someone please explain the difficulty here? If the problem was simply not enough people and time, are there any plans for including it in the next versions of .NET Standard?


Solution

  • I get the impression that you think that things go into netstandard if they "can", but in reality it's more like they go into netstandard if they "have to".

    While this isn't the actual process, a good model is:


    Things that are defined in netstandard require a compatible implementation to define all of the things in it (though "throw new PlatformNotSupportedException();" is a legal implementation of anything). So .NET Framework, .NET Core, Mono, Xamarin, Unity (and any others I can't think of) all need to define a thing. Sometimes the code is shared between these runtimes, but each one carries its own functional implementation; and fixing a bug in one of them requires fixing a bug in all 5+ (or, at least, releasing an update to all 5+).

    On the other hand, when functionality can be delivered purely in terms of things already in netstandard, those things are well suited to being hosted on NuGet, and the same DLL can be loaded into all 5+ runtimes and work correctly. When a bug is fixed, it gets fixed everywhere1,2. Much goodness is had by all. These libraries use the Target Framework Moniker (TFM) of a netstandard version, and then they effectively extend netstandard. The only drawback is that consumers need to explicitly add the package reference to build. System.Security.Cryptography.Xml and System.Security.Cryptography.Pkcs are both in this bucket.


    1. Types that were already in .NET Framework (or Xamarin, etc) still have to be independently fixed in that runtime, because the NuGet package says to ignore its contents and use the existing implementation on those platforms.

    2. For .NET Core, when an assembly is needed as an implementation detail of the runtime it gets included in Microsoft.NETCore.App, and the NuGet package says to ignore its contents and use the existing implementation on that platform, meaning that the bug gets fixed once, but has to be released as both an update to .NET Core and as a NuGet package.