Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the 43 APIs that are in .Net Standard 2.0 but not in .Net Framework 4.6.1?

Tags:

The SO question entitled .NET Standard API Reference, quoting the discussion in https://github.com/dotnet/standard/issues/133, mentions 43 APIs that will be included in the .Net Standard 2.0 but are not supported by .Net Framework 4.6.1. However, I have not been able to find a list of those 43 APIs anywhere on the Internet. The closest I've come in my search is https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.5_diff.md and https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.6_diff.md, which list the APIs introduced in .Net Standard 1.5 and 1.6. At first I thought my search was over, but then I realized:

  1. There are way more than 43 APIs in those two lists, and
  2. Many of them are supported by .Net Framework 4.6.1 already.

Is there, anywhere on the Internet, a list of the 43 specific APIs that are included in .Net Standard 2.0 but not included in .Net Framework 4.6.1?

like image 756
rmunn Avatar asked Apr 25 '17 03:04

rmunn


People also ask

What is the difference between .NET Standard and .NET framework?

Net Standard is not a framework or platform of its own. It does not have implementations or a runtime, it just defines a specification what different . Net platforms has to implement to remain .

Is .NET framework 4.8 compatible with standard?

You cannot consume a . Net Standard 2.1 assembly in any . Net Framework Version because the . NET Framework (even the last ever version, 4.8) does not implement .

Is .NET standard compatible with .NET framework?

NET Framework, Mono, Xamarin or Unity has to implement - at minimum - to support that version of the Standard. For library authors targeting . NET Standard provides the same feature set across all supported platforms - if it compiles to . NET Standard it'll very likely run on those frameworks.


2 Answers

By using https://apisof.net and checking it against every API listed in https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.5_diff.md and https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.6_diff.md, I've managed to put together a list of the APIs present in .Net Standard 1.6 but missing in .Net Framework 4.6.1:

  • System.Diagnostics.Tracing.EventCounter:
    • public EventCounter(string name, EventSource eventSource) (not in .Net Framework)
    • public void WriteMetric(float value) (not in .Net Framework)
  • System.Diagnostics.Tracing.EventSource:
    • public event EventHandler<EventCommandEventArgs> EventCommandExecuted (in .Net Framework 4.6.2, but not 4.6.1)
  • System.IO.BufferedStream:
    • public int BufferSize { get; } (not in .Net Framework)
    • public Stream UnderlyingStream { get; } (not in .Net Framework)
  • System.Reflection.TypeInfo: all the following APIs, none of which are in .Net Framework

    public virtual bool IsCOMObject { get; }
    public override MemberTypes MemberType { get; }
    public virtual StructLayoutAttribute StructLayoutAttribute { get; }
    public ConstructorInfo TypeInitializer { get; }
    public virtual Type UnderlyingSystemType { get; }
    public virtual Type[] FindInterfaces(TypeFilter filter, object filterCriteria);
    public virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria);
    public ConstructorInfo GetConstructor(Type[] types);
    public ConstructorInfo[] GetConstructors();
    public virtual ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
    public virtual MemberInfo[] GetDefaultMembers();
    public virtual string GetEnumName(object value);
    public virtual string[] GetEnumNames();
    public virtual Type GetEnumUnderlyingType();
    public virtual Array GetEnumValues();
    public EventInfo GetEvent(string name);
    public virtual EventInfo GetEvent(string name, BindingFlags bindingAttr);
    public virtual EventInfo[] GetEvents();
    public virtual EventInfo[] GetEvents(BindingFlags bindingAttr);
    public FieldInfo GetField(string name);
    public virtual FieldInfo GetField(string name, BindingFlags bindingAttr);
    public FieldInfo[] GetFields();
    public virtual FieldInfo[] GetFields(BindingFlags bindingAttr);
    public virtual Type[] GetGenericArguments();
    public Type GetInterface(string name);
    public virtual Type GetInterface(string name, bool ignoreCase);
    public virtual Type[] GetInterfaces();
    public MemberInfo[] GetMember(string name);
    public virtual MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
    public virtual MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr);
    public MemberInfo[] GetMembers();
    public virtual MemberInfo[] GetMembers(BindingFlags bindingAttr);
    public MethodInfo GetMethod(string name);
    public MethodInfo GetMethod(string name, BindingFlags bindingAttr);
    public MethodInfo GetMethod(string name, Type[] types);
    public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers);
    public MethodInfo[] GetMethods();
    public virtual MethodInfo[] GetMethods(BindingFlags bindingAttr);
    public Type GetNestedType(string name);
    public virtual Type GetNestedType(string name, BindingFlags bindingAttr);
    public Type[] GetNestedTypes();
    public virtual Type[] GetNestedTypes(BindingFlags bindingAttr);
    public PropertyInfo[] GetProperties();
    public virtual PropertyInfo[] GetProperties(BindingFlags bindingAttr);
    public PropertyInfo GetProperty(string name);
    public PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
    public PropertyInfo GetProperty(string name, Type returnType);
    public PropertyInfo GetProperty(string name, Type returnType, Type[] types);
    public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers);
    public PropertyInfo GetProperty(string name, Type[] types);
    public virtual bool IsAssignableFrom(Type c);
    public virtual bool IsEnumDefined(object value);
    public virtual bool IsEquivalentTo(Type other);
    public virtual bool IsInstanceOfType(object o);
    
  • System.AppContext:
    • public static string TargetFrameworkName { get; } (not in .Net Framework)
    • public static object GetData(string name) (not in .Net Framework)
  • System.Linq.Enumerable:
    • public static IEnumerable<TSource> Append<TSource>(this IEnumerable<TSource> source, TSource element) (not in .Net Framework)
    • public static IEnumerable<TSource> Prepend<TSource>(this IEnumerable<TSource> source, TSource element) (not in .Net Framework)
  • System.Security.Cryptography.ECCurve: entire ECCurve struct, and everything in it (including the System.Security.Cryptography.ECCurve.NamedCurves static class), are not in .Net Framework. In other words, all of the APIs in the following list are new in .Net Core and cannot be found in .Net Framework 4.6.1 (or 4.6.2):

    public struct ECCurve {
        public enum ECCurveType {
            Characteristic2 = 4,
            Implicit = 0,
            Named = 5,
            PrimeMontgomery = 3,
            PrimeShortWeierstrass = 1,
            PrimeTwistedEdwards = 2,
        }
        public static class NamedCurves {
            public static ECCurve brainpoolP160r1 { get; }
            public static ECCurve brainpoolP160t1 { get; }
            public static ECCurve brainpoolP192r1 { get; }
            public static ECCurve brainpoolP192t1 { get; }
            public static ECCurve brainpoolP224r1 { get; }
            public static ECCurve brainpoolP224t1 { get; }
            public static ECCurve brainpoolP256r1 { get; }
            public static ECCurve brainpoolP256t1 { get; }
            public static ECCurve brainpoolP320r1 { get; }
            public static ECCurve brainpoolP320t1 { get; }
            public static ECCurve brainpoolP384r1 { get; }
            public static ECCurve brainpoolP384t1 { get; }
            public static ECCurve brainpoolP512r1 { get; }
            public static ECCurve brainpoolP512t1 { get; }
            public static ECCurve nistP256 { get; }
            public static ECCurve nistP384 { get; }
            public static ECCurve nistP521 { get; }
        }
        public byte[] A;
        public byte[] B;
        public byte[] Cofactor;
        public ECCurve.ECCurveType CurveType;
        public ECPoint G;
        public Nullable<HashAlgorithmName> Hash;
        public byte[] Order;
        public byte[] Polynomial;
        public byte[] Prime;
        public byte[] Seed;
        public bool IsCharacteristic2 { get; }
        public bool IsExplicit { get; }
        public bool IsNamed { get; }
        public bool IsPrime { get; }
        public Oid Oid { get; }
        public static ECCurve CreateFromFriendlyName(string oidFriendlyName);
        public static ECCurve CreateFromOid(Oid curveOid);
        public static ECCurve CreateFromValue(string oidValue);
        public void Validate();
    }
    
  • System.Security.Cryptography.ECParameters struct: not in .Net Framework
  • System.Security.Cryptography.ECPoint struct: not in .Net Framework
  • System.Security.Cryptography.ECDsa:
    • public static ECDsa Create(ECCurve curve) (not in .Net Framework)
    • public static ECDsa Create(ECParameters parameters) (not in .Net Framework)
    • public virtual ECParameters ExportExplicitParameters(bool includePrivateParameters) (not in .Net Framework)
    • public virtual ECParameters ExportParameters(bool includePrivateParameters) (not in .Net Framework)
    • public virtual void GenerateKey(ECCurve curve) (not in .Net Framework)
    • public virtual void ImportParameters(ECParameters parameters) (not in .Net Framework)
  • System.Text.RegularExpressions.Regex:
    • protected IDictionary CapNames { get; set; } (not in .Net Framework)
    • protected IDictionary Caps { get; set; } (not in .Net Framework)

That's a lot more than 43 APIs. I haven't yet gone through the .Net Standard 2.0 API list (it's huge); once I do, I'll edit this answer to reflect what I find.

like image 187
rmunn Avatar answered Oct 23 '22 13:10

rmunn


I posted a similar question in .Net Standard project

All credit goto @benaadams

You can find the missing apis in: ApiCompatBaseline.net461.txt

I checked the file and find 52 entry (more than 43 !).

The 52 missing APIs are:

     Member 'System.AppContext.GetData(System.String)' 
     Member 'System.AppContext.TargetFrameworkName.get()' 
     Type 'System.StringNormalizationExtensions' 
     Type 'System.Data.Common.DbColumn' 
     Type 'System.Data.Common.DbDataReaderExtensions' 
     Type 'System.Data.Common.IDbColumnSchemaGenerator' 
     Type 'System.Diagnostics.StackFrameExtensions' 
     Type 'System.Diagnostics.Tracing.EventCounter' 
     Member 'System.Diagnostics.Tracing.EventSource.add_EventCommandExecuted(System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs>)' 
     Member 'System.Diagnostics.Tracing.EventSource.remove_EventCommandExecuted(System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs>)' 
     Type 'System.Globalization.GlobalizationExtensions' 
     Member 'System.Linq.Enumerable.Append<TSource>(System.Collections.Generic.IEnumerable<TSource>, TSource)' 
     Member 'System.Linq.Enumerable.Prepend<TSource>(System.Collections.Generic.IEnumerable<TSource>, TSource)' 
     Member 'System.Linq.Expressions.Expression<TDelegate>.Compile(System.Boolean)' 
     Member 'System.Linq.Expressions.LambdaExpression.Compile(System.Boolean)' 
     Member 'System.Net.Http.HttpClientHandler.CheckCertificateRevocationList.get()' 
     Member 'System.Net.Http.HttpClientHandler.CheckCertificateRevocationList.set(System.Boolean)' 
     Member 'System.Net.Http.HttpClientHandler.ClientCertificates.get()' 
     Member 'System.Net.Http.HttpClientHandler.DefaultProxyCredentials.get()' 
     Member 'System.Net.Http.HttpClientHandler.DefaultProxyCredentials.set(System.Net.ICredentials)' 
     Member 'System.Net.Http.HttpClientHandler.MaxConnectionsPerServer.get()' 
     Member 'System.Net.Http.HttpClientHandler.MaxConnectionsPerServer.set(System.Int32)' 
     Member 'System.Net.Http.HttpClientHandler.MaxResponseHeadersLength.get()' 
     Member 'System.Net.Http.HttpClientHandler.MaxResponseHeadersLength.set(System.Int32)' 
     Member 'System.Net.Http.HttpClientHandler.Properties.get()' 
     Member 'System.Net.Http.HttpClientHandler.ServerCertificateCustomValidationCallback.get()' 
     Member 'System.Net.Http.HttpClientHandler.ServerCertificateCustomValidationCallback.set(System.Func<System.Net.Http.HttpRequestMessage, System.Security.Cryptography.X509Certificates.X509Certificate2, System.Security.Cryptography.X509Certificates.X509Chain, System.Net.Security.SslPolicyErrors, System.Boolean>)' 
     Member 'System.Net.Http.HttpClientHandler.SslProtocols.get()' 
     Member 'System.Net.Http.HttpClientHandler.SslProtocols.set(System.Security.Authentication.SslProtocols)' 
     Type 'System.Net.Sockets.SocketReceiveFromResult' 
     Type 'System.Net.Sockets.SocketReceiveMessageFromResult' 
     Type 'System.Net.Sockets.SocketTaskExtensions' 
     Type 'System.Runtime.Serialization.DataContractSerializerExtensions' 
     Type 'System.Runtime.Serialization.ISerializationSurrogateProvider' 
     Type 'System.Security.SecureStringMarshal' 
     Type 'System.Security.Cryptography.ECCurve' 
     Member 'System.Security.Cryptography.ECDsa.Create(System.Security.Cryptography.ECCurve)' 
     Member 'System.Security.Cryptography.ECDsa.Create(System.Security.Cryptography.ECParameters)' 
     Member 'System.Security.Cryptography.ECDsa.ExportExplicitParameters(System.Boolean)' 
     Member 'System.Security.Cryptography.ECDsa.ExportParameters(System.Boolean)' 
     Member 'System.Security.Cryptography.ECDsa.GenerateKey(System.Security.Cryptography.ECCurve)' 
     Member 'System.Security.Cryptography.ECDsa.ImportParameters(System.Security.Cryptography.ECParameters)' 
     Type 'System.Security.Cryptography.ECParameters' 
     Type 'System.Security.Cryptography.ECPoint' 
     Type 'System.Security.Cryptography.IncrementalHash' 
     Member 'System.Text.RegularExpressions.Regex.CapNames.get()' 
     Member 'System.Text.RegularExpressions.Regex.CapNames.set(System.Collections.IDictionary)' 
     Member 'System.Text.RegularExpressions.Regex.Caps.get()' 
     Member 'System.Text.RegularExpressions.Regex.Caps.set(System.Collections.IDictionary)' 
     Type 'System.Threading.PreAllocatedOverlapped' 
     Type 'System.Threading.ThreadPoolBoundHandle' 
     Type 'System.Xml.XPath.XDocumentExtensions' 

I checked most of these API and found that they are not available in net461, but available in netstandard2


Update Nov, 2017:

With the final release of .NET Framework 4.7.1, all missing APIs in 4.6.1 are implemented.

List of implemented API

Now .Net Standard 2.0 are built right into the .NET Framework 4.7.1 itself without the need to install .Net Standard 2.0 supported binaries.

like image 32
M.Hassan Avatar answered Oct 23 '22 13:10

M.Hassan