题为.NET Standard API Reference的SO问题引用了https://github.com/dotnet/standard/issues/133中的讨论,提到了将包含在.Net Standard 2.0中但不受.Net Framework 4.6.1支持的43个API。但是,我无法在Internet上的任何地方找到这43个API的列表。我搜索到的最接近的是https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.5_diff.md和https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.6_diff.md,它列出了.Net Standard 1.5和1.6中引入的API。起初我以为我的搜索结束了,但后来我才意识到:
互联网上是否有任何地方,包含在.Net Standard 2.0中但未包含在.Net Framework 4.6.1中的43个特定 API的列表?
答案 0 :(得分:9)
使用https://apisof.net并针对https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.5_diff.md和https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.6_diff.md中列出的每个API进行检查,我设法将.Net Standard 1.6中存在的API列表放在一起,但遗漏了在.Net Framework 4.6.1中:
System.Diagnostics.Tracing.EventCounter
:
public EventCounter(string name, EventSource eventSource)
(不在.Net Framework中)public void WriteMetric(float value)
(不在.Net Framework中)System.Diagnostics.Tracing.EventSource
:
public event EventHandler<EventCommandEventArgs> EventCommandExecuted
(在.Net Framework 4.6.2中,但不是4.6.1)System.IO.BufferedStream
:
public int BufferSize { get; }
(不在.Net Framework中)public Stream UnderlyingStream { get; }
(不在.Net Framework中) System.Reflection.TypeInfo
:以下所有API,其中没有一个在.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; }
(不在.Net Framework中)public static object GetData(string name)
(不在.Net Framework中)System.Linq.Enumerable
:
public static IEnumerable<TSource> Append<TSource>(this IEnumerable<TSource> source, TSource element)
(不在.Net Framework中)public static IEnumerable<TSource> Prepend<TSource>(this IEnumerable<TSource> source, TSource element)
(不在.Net Framework中) System.Security.Cryptography.ECCurve
:整个ECCurve
结构,其中的所有内容(包括System.Security.Cryptography.ECCurve.NamedCurves
静态类)都不在.Net Framework中。换句话说,以下列表中的所有API都是.Net Core中的新增功能,并且无法在.Net Framework 4.6.1(或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:不在.Net Framework System.Security.Cryptography.ECPoint
struct:不在.Net Framework System.Security.Cryptography.ECDsa
:
public static ECDsa Create(ECCurve curve)
(不在.Net Framework中)public static ECDsa Create(ECParameters parameters)
(不在.Net Framework中)public virtual ECParameters ExportExplicitParameters(bool includePrivateParameters)
(不在.Net Framework中)public virtual ECParameters ExportParameters(bool includePrivateParameters)
(不在.Net Framework中)public virtual void GenerateKey(ECCurve curve)
(不在.Net Framework中)public virtual void ImportParameters(ECParameters parameters)
(不在.Net Framework中)System.Text.RegularExpressions.Regex
:
protected IDictionary CapNames { get; set; }
(不在.Net Framework中)protected IDictionary Caps { get; set; }
(不在.Net Framework中)这比43个API要多得多。我还没有通过.Net Standard 2.0 API列表(它是巨大的);一旦我这样做,我就会编辑这个答案,以反映我的发现。
答案 1 :(得分:3)
所有赠送金额@benaadams
您可以在ApiCompatBaseline.net461.txt
中找到遗失的api我检查了文件并找到了52个条目(超过43个!)。
缺少52个API:
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'
我检查了大部分这些API,发现它们在net461中不可用,但在netstandard2中可用
缺少的API预计将在.Net Framework 7.1 .NET Framework 4.7.1 provides built-in support for .NET Standard 2.0
中实现the .NET Framework 4.7.1 Early Access
2017年11月更新:
随着.NET Framework 4.7.1的最终版本的发布,4.6.1中所有缺失的API都已实现。
现在.Net Standard 2.0内置于.NET Framework 4.7.1本身,无需安装.Net Standard 2.0支持的二进制文件。