Conditional compilation using the above-mentioned constant (from `ref\System.Net.Security.cs`):
```
-#if netcoreapp11
+#if NETCOREAPP
public virtual void AuthenticateAsClient(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, bool checkCertificateRevocation) { }
#endif
```
if (NetEventSource.IsEnabled) NetEventSource.Enter(null, contextAttribute);
Span<T> span =
-#if netstandard
+#if NETSTANDARD2_0
stackalloc T[1] { attribute };
#else
MemoryMarshal.CreateSpan(ref attribute, 1);
MemoryMarshal.AsBytes(span),
null,
out SafeHandle sspiHandle);
-#if netstandard
+#if NETSTANDARD2_0
attribute = span[0];
#endif
if (NetEventSource.IsEnabled) NetEventSource.Enter(null, contextAttribute);
Span<T> span =
-#if netstandard
+#if NETSTANDARD2_0
stackalloc T[1] { attribute };
#else
MemoryMarshal.CreateSpan(ref attribute, 1);
MemoryMarshal.AsBytes(span),
safeHandleType,
out sspiHandle);
-#if netstandard
+#if NETSTANDARD2_0
attribute = span[0];
#endif
if (NetEventSource.IsEnabled) NetEventSource.Enter(null);
Span<Interop.SspiCli.SecPkgContext_IssuerListInfoEx> buffer =
-#if netstandard
+#if NETSTANDARD2_0
stackalloc Interop.SspiCli.SecPkgContext_IssuerListInfoEx[1] { ctx };
#else
MemoryMarshal.CreateSpan(ref ctx, 1);
MemoryMarshal.AsBytes(buffer),
typeof(SafeFreeContextBuffer),
out sspiHandle);
-#if netstandard
+#if NETSTANDARD2_0
ctx = buffer[0];
#endif
{
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")]
[TypeForwardedFrom("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
-#if netcoreapp20
+#if NETCOREAPP2_0
internal
#else
public
ref byte[] resultBlob,
ref ContextFlagsPal contextFlags)
{
-#if netstandard
+#if NETSTANDARD2_0
Span<SecurityBuffer> inSecurityBufferSpan = new SecurityBuffer[2];
#else
TwoSecurityBuffers twoSecurityBuffers = default;
ref byte[] resultBlob,
ref ContextFlagsPal contextFlags)
{
-#if netstandard
+#if NETSTANDARD2_0
Span<SecurityBuffer> inSecurityBufferSpan = new SecurityBuffer[2];
#else
TwoSecurityBuffers twoSecurityBuffers = default;
// setup security buffers for ssp call
// one points at signed data
// two will receive payload if signature is valid
-#if netstandard
+#if NETSTANDARD2_0
Span<SecurityBuffer> securityBuffer = new SecurityBuffer[2];
#else
TwoSecurityBuffers stackBuffer = default;
Buffer.BlockCopy(buffer, offset, output, sizes.cbMaxSignature, count);
// setup security buffers for ssp call
-#if netstandard
+#if NETSTANDARD2_0
Span<SecurityBuffer> securityBuffer = new SecurityBuffer[2];
#else
TwoSecurityBuffers stackBuffer = default;
internal static class SecurityProtocol
{
public const SslProtocols DefaultSecurityProtocols =
-#if !netstandard && !netfx
+#if !NETSTANDARD2_0 && !NETFRAMEWORK
SslProtocols.Tls13 |
#endif
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
return new FunctionLoadResult<T>(FunctionLoadResultKind.LibraryNotFound, null);
}
-#if netcoreapp20
+#if NETCOREAPP2_0
IntPtr funcPtr = LoadFunctionPointer(nativeLibraryHandle, funcName);
if (funcPtr == IntPtr.Zero)
{
}
public
-#if netcoreapp || netcoreapp30 || uap || NETCOREAPP || netstandard21
+#if uap || NETCOREAPP || NETSTANDARD2_1
override
#endif
int GetByteCount(ReadOnlySpan<char> chars)
}
public
-#if netcoreapp || netcoreapp30 || uap || NETCOREAPP || netstandard21
+#if uap || NETCOREAPP || NETSTANDARD2_1
override
#endif
int GetCharCount(ReadOnlySpan<byte> bytes)
return s_utf8Encoding.GetByteCount(s);
}
-#if netcoreapp || netcoreapp30 || uap || NETCOREAPP || netstandard21
+#if uap || NETCOREAPP || NETSTANDARD2_1
public override int GetByteCount(ReadOnlySpan<char> chars)
{
return s_utf8Encoding.GetByteCount(chars);
}
}
-#if netcoreapp || netcoreapp30 || uap || NETCOREAPP || netstandard21
+#if uap || NETCOREAPP || NETSTANDARD2_1
public override int GetCharCount(ReadOnlySpan<byte> bytes)
{
try
_offset += bitString.Length;
}
-#if netcoreapp || uap || NETCOREAPP || netstandard21
+#if uap || NETCOREAPP || NETSTANDARD2_1
/// <summary>
/// Write a Bit String value via a callback, with a tag UNIVERSAL 3.
/// </summary>
if (!clearWholeArray && clearSize != 0)
{
-#if netcoreapp || netcoreapp30 || uap || NETCOREAPP || netstandard21
+#if uap || NETCOREAPP || NETSTANDARD2_1
CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
#else
Array.Clear(array, 0, clearSize);
{
get
{
-#if netcoreapp
+#if NETCOREAPP
if (IsWindows)
{
#endif
return IsNotWindowsNanoServer && IsNotWindowsServerCore && !IsUap;
-#if netcoreapp
+#if NETCOREAPP
}
else if (IsOSX)
{
using (Stream entrystream = entry.Open())
{
entrystream.Read(buffer, 0, buffer.Length);
-#if netcoreapp || uap
+#if NETCOREAPP || uap
uint zipcrc = entry.Crc32;
Assert.Equal(CRC.CalculateCRC(buffer), zipcrc.ToString());
#endif
public int ListenBacklog { get; set; } = 1;
public bool UseSsl { get; set; } = false;
public SslProtocols SslProtocols { get; set; } =
-#if !netstandard
+#if !NETSTANDARD2_0
SslProtocols.Tls13 |
#endif
SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
_readStart += copyLength;
return copyLength;
}
-#if NETSTANDARD
+#if NETSTANDARD2_0
// stream does not have Memory<t> overload
byte[] tempBuffer = new byte[size];
int readLength = await _stream.ReadAsync(tempBuffer, 0, size).ConfigureAwait(false);
public class SslProtocolSupport
{
public const SslProtocols DefaultSslProtocols =
-#if !netstandard
+#if !NETSTANDARD2_0
SslProtocols.Tls13 |
#endif
SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls;
supported |= SslProtocols.Ssl3;
}
#pragma warning restore 0618
-#if !netstandard
+#if !NETSTANDARD2_0
// TLS 1.3 is new
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && PlatformDetection.OpenSslVersion >= new Version(1, 1, 1))
{
}
}
-#if netcoreapp
+#if NETCOREAPP
public sealed class DSASignVerify_Span : DSASignVerify
{
public override byte[] SignData(DSA dsa, byte[] data, HashAlgorithmName hashAlgorithm) =>
{
public class CurveDef
{
-#if netcoreapp
+#if NETCOREAPP
public CurveDef() { }
public ECCurve Curve;
public ECCurve.ECCurveType CurveType;
/// </summary>
public abstract class EccTestBase
{
-#if netcoreapp
+#if NETCOREAPP
internal const string ECDSA_P224_OID_VALUE = "1.3.132.0.33"; // Also called nistP224 or secP224r1
internal const string ECDSA_P256_OID_VALUE = "1.2.840.10045.3.1.7"; // Also called nistP256, secP256r1 or prime256v1(OpenSsl)
internal const string ECDSA_P384_OID_VALUE = "1.3.132.0.34"; // Also called nistP384 or secP384r1
}
}
}
-#endif // netcoreapp
+#endif
}
}
{
ECDiffieHellman Create();
ECDiffieHellman Create(int keySize);
-#if netcoreapp
+#if NETCOREAPP
ECDiffieHellman Create(ECCurve curve);
#endif
bool IsCurveValid(Oid oid);
return s_provider.Create(keySize);
}
-#if netcoreapp
+#if NETCOREAPP
public static ECDiffieHellman Create(ECCurve curve)
{
return s_provider.Create(curve);
};
}
-#if netcoreapp
+#if NETCOREAPP
[Theory]
[MemberData(nameof(HashDerivationTestCases))]
public static void HashDerivation_KnownResults(
};
}
-#if netcoreapp
+#if NETCOREAPP
[Theory]
[MemberData(nameof(HmacDerivationTestCases))]
public static void HmacDerivation_KnownResults(
namespace System.Security.Cryptography.EcDiffieHellman.Tests
{
-#if netcoreapp
+#if NETCOREAPP
public partial class ECDiffieHellmanTests
{
// On CentOS, secp224r1 (also called nistP224) appears to be disabled. To prevent test failures on that platform,
namespace System.Security.Cryptography.EcDiffieHellman.Tests
{
-#if netcoreapp
+#if NETCOREAPP
// These test cases are from http://csrc.nist.gov/groups/STM/cavp/component-testing.html#test-vectors
// SP 800-56A ECCCDH Primitive test vectors
// ecccdhtestvectors.zip
};
}
-#if netcoreapp
+#if NETCOREAPP
[Theory]
[MemberData(nameof(TlsDerivationTestCases))]
public static void TlsDerivation_KnownResults(string labelText, string answerHex)
});
}
-#if netcoreapp
+#if NETCOREAPP
private static ECDiffieHellman OpenKnownKey()
{
ECParameters ecParams = new ECParameters
{
ECDsa Create();
ECDsa Create(int keySize);
-#if netcoreapp
+#if NETCOREAPP
ECDsa Create(ECCurve curve);
#endif
bool IsCurveValid(Oid oid);
return s_provider.Create(keySize);
}
-#if netcoreapp
+#if NETCOREAPP
public static ECDsa Create(ECCurve curve)
{
return s_provider.Create(curve);
{
public class ECDsaImportExportTests : ECDsaTestsBase
{
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void DiminishedCoordsRoundtrip()
{
throw new NotImplementedException();
}
-#if netcoreapp
+#if NETCOREAPP
public override void ImportParameters(ECParameters parameters)
{
throw new NotImplementedException();
// FIPS 186-4 ECDSA test vectors
// 186-3ecdsatestvectors.zip
// SigGen.txt
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void ValidateNistP256Sha256()
{
}
}
}
-#endif // netcoreapp
+#endif
}
}
/// </summary>
public abstract class ECDsaTestsBase : EccTestBase
{
-#if netcoreapp
+#if NETCOREAPP
internal static void Verify256(ECDsa e, bool expected)
{
byte[] sig = ("998791331eb2e1f4259297f5d9cb82fa20dec98e1cb0900e6b8f014a406c3d02cbdbf5238bde471c3155fc25565524301429"
return ECDsaFactory.ExplicitCurvesSupported;
}
}
-#endif // netcoreapp
+#endif
}
internal static class EcDsaTestExtensions
<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
- <DisableImplicitFrameworkDefines>true</DisableImplicitFrameworkDefines>
<DisableImplicitConfigurationDefines>true</DisableImplicitConfigurationDefines>
<!-- Workaround for https://github.com/microsoft/msbuild/issues/4474 -->
public System.Collections.Immutable.ImmutableArray<T> Add(T item) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> AddRange(System.Collections.Generic.IEnumerable<T> items) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> AddRange(System.Collections.Immutable.ImmutableArray<T> items) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public System.ReadOnlyMemory<T> AsMemory() { throw null; }
public System.ReadOnlySpan<T> AsSpan() { throw null; }
#endif
public System.Collections.Immutable.ImmutableArray<T> Insert(int index, T item) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { throw null; }
public System.Collections.Immutable.ImmutableArray<T> InsertRange(int index, System.Collections.Immutable.ImmutableArray<T> items) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item) { throw null; }
public int IndexOf(T item, int startIndex, int count) { throw null; }
public int IndexOf(T item, int startIndex, int count, System.Collections.Generic.IEqualityComparer<T> equalityComparer) { throw null; }
public void Insert(int index, T item) { }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item) { throw null; }
public int IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T> equalityComparer) { throw null; }
public System.Collections.Immutable.ImmutableList<T> Insert(int index, T item) { throw null; }
public System.Collections.Immutable.ImmutableList<T> InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T> equalityComparer) { throw null; }
public int IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T> equalityComparer) { throw null; }
public void Insert(int index, T item) { }
public void InsertRange(int index, System.Collections.Generic.IEnumerable<T> items) { }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public int LastIndexOf(T item) { throw null; }
public System.Collections.Immutable.ImmutableQueue<T> Enqueue(T value) { throw null; }
public System.Collections.Immutable.ImmutableQueue<T>.Enumerator GetEnumerator() { throw null; }
public T Peek() { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T PeekRef() { throw null; }
#endif
System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator() { throw null; }
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue>.Builder ToBuilder() { throw null; }
public bool TryGetKey(TKey equalKey, out TKey actualKey) { throw null; }
public bool TryGetValue(TKey key, out TValue value) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly TValue ValueRef(TKey key) { throw null; }
#endif
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue> WithComparers(System.Collections.Generic.IComparer<TKey> keyComparer) { throw null; }
public System.Collections.Immutable.ImmutableSortedDictionary<TKey, TValue> ToImmutable() { throw null; }
public bool TryGetKey(TKey equalKey, out TKey actualKey) { throw null; }
public bool TryGetValue(TKey key, out TValue value) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly TValue ValueRef(TKey key) { throw null; }
#endif
}
public bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public bool Overlaps(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other) { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T ItemRef(int index) { throw null; }
#endif
public bool Overlaps(System.Collections.Generic.IEnumerable<T> other) { throw null; }
public System.Collections.Immutable.ImmutableStack<T> Clear() { throw null; }
public System.Collections.Immutable.ImmutableStack<T>.Enumerator GetEnumerator() { throw null; }
public T Peek() { throw null; }
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ref readonly T PeekRef() { throw null; }
#endif
public System.Collections.Immutable.ImmutableStack<T> Pop() { throw null; }
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element at the specified index.
/// </summary>
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element at the specified index in the read-only list.
/// </summary>
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public ReadOnlySpan<T> AsSpan() => new ReadOnlySpan<T>(array);
public ReadOnlyMemory<T> AsMemory() => new ReadOnlyMemory<T>(array);
result = OperationResult.NoChangeRequired;
return this;
case KeyCollisionBehavior.ThrowIfValueDifferent:
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
ref readonly var existingEntry = ref _additionalElements.ItemRef(keyCollisionIndex);
#else
var existingEntry = _additionalElements[keyCollisionIndex];
return false;
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
value = _additionalElements.ItemRef(index).Value;
#else
value = _additionalElements[index].Value;
return false;
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
actualKey = _additionalElements.ItemRef(index).Key;
#else
actualKey = _additionalElements[index].Key;
int index = _additionalElements.IndexOf(value, valueComparer);
if (index >= 0)
{
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
existingValue = _additionalElements.ItemRef(index);
#else
existingValue = _additionalElements[index];
{
get
{
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
return this.Root.ItemRef(index);
#else
return this.Root[index];
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the value for a given index into the list.
/// </summary>
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element of the set at the given index.
/// </summary>
int end = index + count - 1;
while (start < end)
{
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
T a = result.ItemRef(start);
T b = result.ItemRef(end);
#else
/// <param name="index">The 0-based index of the element in the set to return.</param>
/// <returns>The element at the given position.</returns>
/// <exception cref="IndexOutOfRangeException">Thrown from getter when <paramref name="index"/> is negative or not less than <see cref="Count"/>.</exception>
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
public T this[int index] => _root.ItemRef(index);
#else
public T this[int index] => _root[index];
#endif
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element of the set at the given index.
/// </summary>
return _forwards.Peek();
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element at the front of the queue.
/// </summary>
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Returns a read-only reference to the value associated with the provided key.
/// </summary>
return this.RemoveRecursive(key, keyComparer, out mutated);
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Returns a read-only reference to the value associated with the provided key.
/// </summary>
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Returns a read-only reference to the value associated with the provided key.
/// </summary>
/// </remarks>
public T this[int index]
{
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
get { return _root.ItemRef(index); }
#else
get { return _root[index]; }
#endif
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element of the set at the given index.
/// </summary>
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element of the set at the given index.
/// </summary>
{
get
{
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
return _root.ItemRef(index);
#else
return _root[index];
}
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference of the element of the set at the given index.
/// </summary>
return _head;
}
-#if !NETSTANDARD10
+#if !NETSTANDARD1_0
/// <summary>
/// Gets a read-only reference to the element on the top of the stack.
/// </summary>
Assert.IsType<ArgumentNullException>(tie.InnerException);
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public void UsableWithCollectibleAssemblies()
{
list.GetEnumerator(); // ensure this doesn't throw
}
-#endif // netcoreapp
+#endif
[Fact]
public void ItemRef()
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(OSGroup)' == 'AnyOS'">SR.PlatformNotSupported_DataSqlClient</GeneratePlatformNotSupportedAssemblyMessage>
<AssemblyVersion Condition="'$(TargetGroup)' == 'netstandard1.2'">4.0.0.0</AssemblyVersion>
<AssemblyVersion Condition="'$(TargetGroup)' == 'netstandard1.3'">4.1.0.0</AssemblyVersion>
- <DefineConstants Condition="'$(TargetsNetCoreApp)' != 'true'">$(DefineConstants);netstandard</DefineConstants>
- <DefineConstants Condition="'$(TargetsNetCoreApp)' == 'true'">$(DefineConstants);netcoreapp</DefineConstants>
+ <DefineConstants Condition="'$(TargetsNetCoreApp)' != 'true'">$(DefineConstants);NETSTANDARD2_0</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);FEATURE_TCPKEEPALIVE</DefineConstants>
<DefineConstants Condition="'$(TargetGroup)' != 'netcoreapp'">$(DefineConstants);INTERNAL_NULLABLE_ATTRIBUTES</DefineConstants>
<Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;netcoreapp-Debug;netcoreapp-Release;netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netcoreapp2.1-Debug;netcoreapp2.1-Release;netcoreapp2.1-Unix-Debug;netcoreapp2.1-Unix-Release;netcoreapp2.1-Windows_NT-Debug;netcoreapp2.1-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard-Unix-Debug;netstandard-Unix-Release;netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release;netstandard1.2-Debug;netstandard1.2-Release;netstandard1.3-Debug;netstandard1.3-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release;uap10.0.16299-Windows_NT-Debug;uap10.0.16299-Windows_NT-Release</Configurations>
internal const string MaxPoolSize = "Max Pool Size";
internal const string Pooling = "Pooling";
internal const string MinPoolSize = "Min Pool Size";
-#if netcoreapp
+#if NETCOREAPP
internal const string PoolBlockingPeriod = "PoolBlockingPeriod";
#endif
}
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
-#if !netcoreapp
+#if NETCOREAPP2_1 || !NETCOREAPP
using System.Linq;
#endif
using System.Net;
? _workingDataSource.Substring(firstIndexOfColon + 1).Trim() : _workingDataSource;
// Pipe paths only allow back slashes
-#if netcoreapp
+#if NETCOREAPP
if (_dataSourceAfterTrimmingProtocol.Contains('/')) // string.Contains(char) is .NetCore2.1+ specific
#else
if (_dataSourceAfterTrimmingProtocol.Contains("/"))
internal const string Application_Name = "application name";
internal const string AsynchronousProcessing = "asynchronous processing";
internal const string AttachDBFilename = "attachdbfilename";
-#if netcoreapp
+#if NETCOREAPP
internal const string PoolBlockingPeriod = "poolblockingperiod";
#endif
internal const string Connect_Timeout = "connect timeout";
}
_integratedSecurity = ConvertValueToIntegratedSecurity();
-#if netcoreapp
+#if NETCOREAPP
_poolBlockingPeriod = ConvertValueToPoolBlockingPeriod();
#endif
_encrypt = ConvertValueToBoolean(KEY.Encrypt, DEFAULT.Encrypt);
_userInstance = userInstance;
_connectTimeout = connectionOptions._connectTimeout;
_loadBalanceTimeout = connectionOptions._loadBalanceTimeout;
-#if netcoreapp
+#if NETCOREAPP
_poolBlockingPeriod = connectionOptions._poolBlockingPeriod;
#endif
_maxPoolSize = connectionOptions._maxPoolSize;
{ KEY.Application_Name, KEY.Application_Name },
{ KEY.AsynchronousProcessing, KEY.AsynchronousProcessing },
{ KEY.AttachDBFilename, KEY.AttachDBFilename },
-#if netcoreapp
+#if NETCOREAPP
{ KEY.PoolBlockingPeriod, KEY.PoolBlockingPeriod},
#endif
{ KEY.Connect_Timeout, KEY.Connect_Timeout },
Pooling,
MinPoolSize,
MaxPoolSize,
-#if netcoreapp
+#if NETCOREAPP
PoolBlockingPeriod,
#endif
validKeywords[(int)Keywords.ApplicationIntent] = DbConnectionStringKeywords.ApplicationIntent;
validKeywords[(int)Keywords.ApplicationName] = DbConnectionStringKeywords.ApplicationName;
validKeywords[(int)Keywords.AttachDBFilename] = DbConnectionStringKeywords.AttachDBFilename;
-#if netcoreapp
+#if NETCOREAPP
validKeywords[(int)Keywords.PoolBlockingPeriod] = DbConnectionStringKeywords.PoolBlockingPeriod;
#endif
validKeywords[(int)Keywords.ConnectTimeout] = DbConnectionStringKeywords.ConnectTimeout;
hash.Add(DbConnectionStringKeywords.ApplicationIntent, Keywords.ApplicationIntent);
hash.Add(DbConnectionStringKeywords.ApplicationName, Keywords.ApplicationName);
hash.Add(DbConnectionStringKeywords.AttachDBFilename, Keywords.AttachDBFilename);
-#if netcoreapp
+#if NETCOREAPP
hash.Add(DbConnectionStringKeywords.PoolBlockingPeriod, Keywords.PoolBlockingPeriod);
#endif
hash.Add(DbConnectionStringKeywords.ConnectTimeout, Keywords.ConnectTimeout);
case Keywords.PacketSize: PacketSize = ConvertToInt32(value); break;
case Keywords.IntegratedSecurity: IntegratedSecurity = ConvertToIntegratedSecurity(value); break;
-#if netcoreapp
+#if NETCOREAPP
case Keywords.PoolBlockingPeriod: PoolBlockingPeriod = ConvertToPoolBlockingPeriod(keyword, value); break;
#endif
case Keywords.Encrypt: Encrypt = ConvertToBoolean(value); break;
case Keywords.ApplicationIntent: return this.ApplicationIntent;
case Keywords.ApplicationName: return ApplicationName;
case Keywords.AttachDBFilename: return AttachDBFilename;
-#if netcoreapp
+#if NETCOREAPP
case Keywords.PoolBlockingPeriod: return PoolBlockingPeriod;
#endif
case Keywords.ConnectTimeout: return ConnectTimeout;
case Keywords.AttachDBFilename:
_attachDBFilename = DbConnectionStringDefaults.AttachDBFilename;
break;
-#if netcoreapp
+#if NETCOREAPP
case Keywords.PoolBlockingPeriod:
_poolBlockingPeriod = DbConnectionStringDefaults.PoolBlockingPeriod;
break;
internal void SetGuid(Guid value)
{
Debug.Assert(SmiXetterAccessMap.IsSetterAccessValid(_metaData, SmiXetterTypeCode.XetGuid));
-#if netcoreapp
+#if NETCOREAPP
Span<byte> bytes = stackalloc byte[16];
value.TryWriteBytes(bytes);
#else
_stateObj.WriteByte((byte)_metaData.MaxLength);
}
-#if netcoreapp
+#if NETCOREAPP
_stateObj.WriteByteSpan(bytes);
#else
_stateObj.WriteByteArray(bytes, bytes.Length, 0);
using static Interop.Advapi32;
-#if !netcoreapp
+#if NETCOREAPP2_0 || !NETCOREAPP
using MemoryMarshal = System.Diagnostics.PerformanceCounterLib;
#endif
}
}
-#if !netcoreapp
+#if NETCOREAPP2_0 || !NETCOREAPP
internal static T Read<T>(ReadOnlySpan<byte> span) where T : struct
=> System.Runtime.InteropServices.MemoryMarshal.Read<T>(span);
Whiteness = 16711778,
CaptureBlt = 1073741824,
}
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[System.ComponentModel.TypeConverterAttribute("System.Drawing.FontConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public sealed partial class Font : System.MarshalByRefObject, System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
Document = 5,
Millimeter = 6,
}
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[System.ComponentModel.TypeConverterAttribute("System.Drawing.IconConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public sealed partial class Icon : System.MarshalByRefObject, System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
void ReleaseHdc();
}
[System.ComponentModel.ImmutableObjectAttribute(true)]
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[System.ComponentModel.TypeConverterAttribute("System.Drawing.ImageConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public abstract partial class Image : System.MarshalByRefObject, System.ICloneable, System.IDisposable, System.Runtime.Serialization.ISerializable
ReadOnly = 65536,
Caching = 131072,
}
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[System.ComponentModel.TypeConverterAttribute("System.Drawing.ImageFormatConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public sealed partial class ImageFormat
protected InvalidPrinterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[System.ComponentModel.TypeConverterAttribute("System.Drawing.Printing.MarginsConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public partial class Margins : System.ICloneable
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <OutputType>Library</OutputType>
<DefineConstants>$(DefineConstants);DRAWING_NAMESPACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
- <DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
<DefineConstants Condition="'$(TargetsWindows)' == 'true'">$(DefineConstants);FEATURE_WINDOWS_SYSTEM_COLORS;FEATURE_SYSTEM_EVENTS</DefineConstants>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsUap)' == 'true'">SR.PlatformNotSupported_Drawing</GeneratePlatformNotSupportedAssemblyMessage>
<Configurations>netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netcoreapp3.0-Unix-Debug;netcoreapp3.0-Unix-Release;netcoreapp3.0-Windows_NT-Debug;netcoreapp3.0-Windows_NT-Release;uap-Debug;uap-Release</Configurations>
</PropertyGroup>
<!-- Shared source code, all configurations -->
- <ItemGroup Condition="$(TargetGroup.StartsWith('netcoreapp'))">
+ <ItemGroup Condition="'$(TargetsNetCoreApp)' == 'true'">
<Compile Include="System\Drawing\Bitmap.cs" />
<Compile Include="System\Drawing\BitmapSuffixInSameAssemblyAttribute.cs" />
<Compile Include="System\Drawing\BitmapSuffixInSatelliteAssemblyAttribute.cs" />
</EmbeddedResource>
</ItemGroup>
<!-- Windows-specific -->
- <ItemGroup Condition="$(TargetGroup.StartsWith('netcoreapp')) AND '$(TargetsWindows)' == 'true'">
+ <ItemGroup Condition="'$(TargetsNetCoreApp)' == 'true' and '$(TargetsWindows)' == 'true'">
<Compile Include="SRDescriptionAttribute.cs" />
<Compile Include="System\Drawing\Bitmap.Windows.cs" />
<Compile Include="System\Drawing\BitmapSelector.cs" />
</Compile>
</ItemGroup>
<!-- Unix specific -->
- <ItemGroup Condition="$(TargetGroup.StartsWith('netcoreapp')) AND '$(TargetsUnix)' == 'true'">
+ <ItemGroup Condition="'$(TargetsNetCoreApp)' == 'true' and '$(TargetsUnix)' == 'true'">
<Compile Include="System\Drawing\Graphics.Unix.cs" />
<Compile Include="System\Drawing\Icon.Unix.cs" />
<Compile Include="System\Drawing\SystemFonts.Unix.cs" />
namespace System.Drawing
{
-#if !NETCORE
- [Editor ("System.Drawing.Design.BitmapEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
-#endif
public sealed partial class Bitmap
{
#region constructors
namespace System.Drawing
{
-#if !NETCORE
- [Editor ("System.Drawing.Design.FontEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
- [TypeConverter (typeof (FontConverter))]
-#endif
public sealed partial class Font
{
private const byte DefaultCharSet = 1;
/// <summary>
/// Defines a particular format for text, including font face, size, and style attributes.
/// </summary>
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[TypeConverter("System.Drawing.FontConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
[Serializable]
/// Gets the face name of this <see cref='Font'/> .
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-#if !NETCORE
- [Editor ("System.Drawing.Design.FontNameEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
- [TypeConverter (typeof (FontConverter.FontNameConverter))]
-#endif
public string Name => FontFamily.Name;
/// <summary>
/// Gets the unit of measure for this <see cref='Font'/>.
/// </summary>
-#if !NETCORE
- [TypeConverter (typeof (FontConverter.FontUnitConverter))]
-#endif
public GraphicsUnit Unit => _fontUnit;
/// <summary>
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if netcoreapp20
-using System.Buffers;
-#endif
-
using System.IO;
using System.Runtime.InteropServices;
try
{
- // Stream Span API isn't available in 2.0
-#if netcoreapp20
- byte[] buffer = ArrayPool<byte>.Shared.Rent(bufsz);
- read = _stream.Read(buffer, 0, bufsz);
- Marshal.Copy(buffer, 0, (IntPtr)buf, read);
- ArrayPool<byte>.Shared.Return(buffer);
-#else
Span<byte> buffer = new Span<byte>(buf, bufsz);
read = _stream.Read(buffer);
-#endif
}
catch (IOException)
{
if (!_stream.CanWrite)
return -1;
- // Stream Span API isn't available in 2.0
-#if netcoreapp20
- byte[] buffer = ArrayPool<byte>.Shared.Rent(bufsz);
- Marshal.Copy((IntPtr)buf, buffer, 0, bufsz);
- _stream.Write(buffer, 0, bufsz);
- ArrayPool<byte>.Shared.Return(buffer);
-#else
var buffer = new ReadOnlySpan<byte>(buf, bufsz);
_stream.Write(buffer);
-#endif
+
return bufsz;
}
{
libraryName = "libgdiplus.dylib";
-#if netcoreapp20
- lib = Interop.Libdl.dlopen(libraryName, Interop.Libdl.RTLD_LAZY);
-#else // use managed NativeLibrary API from .NET Core 3 onwards
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
NativeLibrary.TryLoad(libraryName, assembly, default, out lib);
-#endif
}
else
{
// the name suffixed with ".0".
libraryName = "libgdiplus.so";
-#if netcoreapp20
- lib = Interop.Libdl.dlopen(libraryName, Interop.Libdl.RTLD_LAZY);
- if (lib == IntPtr.Zero)
- {
- lib = Interop.Libdl.dlopen("libgdiplus.so.0", Interop.Libdl.RTLD_LAZY);
- }
-#else // use managed NativeLibrary API from .NET Core 3 onwards
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
if (!NativeLibrary.TryLoad(libraryName, assembly, default, out lib))
{
NativeLibrary.TryLoad("libgdiplus.so.0", assembly, default, out lib);
}
-#endif
- }
-
-#if netcoreapp20
- // If we couldn't find libgdiplus in the system search path, try to look for libgdiplus in the
- // NuGet package folders. This matches the DllImport behavior.
- if (lib == IntPtr.Zero)
- {
- string[] searchDirectories = ((string)AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES")).Split(':');
-
- foreach (var searchDirectory in searchDirectories)
- {
- var searchPath = Path.Combine(searchDirectory, libraryName);
-
- lib = Interop.Libdl.dlopen(searchPath, Interop.Libdl.RTLD_LAZY);
- if (lib != IntPtr.Zero)
- {
- break;
- }
- }
}
-#endif
// This function may return a null handle. If it does, individual functions loaded from it will throw a DllNotFoundException,
// but not until an attempt is made to actually use the function (rather than load it). This matches how PInvokes behave.
namespace System.Drawing
{
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[System.ComponentModel.TypeConverter("System.Drawing.IconConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
-#else
-#if !NETCORE
-#if !MONOTOUCH
- [Editor("System.Drawing.Design.IconEditor, " + Consts.AssemblySystem_Drawing_Design, typeof(System.Drawing.Design.UITypeEditor))]
-#endif
- [TypeConverter(typeof(IconConverter))]
-#endif
#endif
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
{
}
-#if !MONOTOUCH
private Icon(IntPtr handle)
{
this.handle = handle;
// FIXME: we need to convert the bitmap into an icon
undisposable = true;
}
-#endif
public Icon(Icon original, int width, int height)
: this(original, new Size(width, height))
return new Icon(this, Size);
}
-#if !MONOTOUCH
public static Icon FromHandle(IntPtr handle)
{
if (handle == IntPtr.Zero)
return new Icon(handle);
}
-#endif
+
private void SaveIconImage(BinaryWriter writer, IconImage ii)
{
BitmapInfoHeader bih = ii.iconHeader;
// save every icons available
Save(outputStream, -1, -1);
}
-#if !MONOTOUCH
+
internal Bitmap BuildBitmapOnWin32()
{
Bitmap bmp;
// Image16 for the differences
return new Bitmap(GetInternalBitmap());
}
-#endif
+
public override string ToString()
{
//is this correct, this is what returned by .Net
return "<Icon>";
}
-#if !MONOTOUCH
[Browsable(false)]
public IntPtr Handle
{
return handle;
}
}
-#endif
+
[Browsable(false)]
public int Height
{
namespace System.Drawing
{
- [Serializable]
- [TypeForwardedFrom("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[TypeConverter("System.Drawing.IconConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
+ [Serializable]
+ [TypeForwardedFrom("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public sealed partial class Icon : MarshalByRefObject, ICloneable, IDisposable, ISerializable
{
#if FINALIZATION_WATCH
namespace System.Drawing
{
-#if !NETCORE
-[Editor ("System.Drawing.Design.ImageEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
-[TypeConverter (typeof(ImageConverter))]
-#endif
public abstract partial class Image
{
// public methods
[ImmutableObject(true)]
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[TypeConverter("System.Drawing.ImageConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public abstract partial class Image : MarshalByRefObject, IDisposable, ICloneable, ISerializable
[Localizable(false)]
[DefaultValue(null)]
-#if !NETCORE
- [BindableAttribute(true)]
- [TypeConverter(typeof(StringConverter))]
-#endif
public object Tag
{
get => _userData;
/// <summary>
/// Specifies the format of the image.
/// </summary>
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[TypeConverter("System.Drawing.ImageFormatConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public sealed class ImageFormat
namespace System.Drawing.Imaging
{
-#if !NETCORE
- [Editor ("System.Drawing.Design.MetafileEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
-#endif
public sealed partial class Metafile : Image
{
// Usually called when cloning images that need to have
{
ActualizeVirtualPosition();
- // Stream Span API isn't available in 2.0
-#if netcoreapp20
- byte[] buffer = ArrayPool<byte>.Shared.Rent(checked((int)cb));
- Marshal.Copy((IntPtr)pv, buffer, 0, checked((int)cb));
- _dataStream.Write(buffer, 0, checked((int)cb));
- ArrayPool<byte>.Shared.Return(buffer);
-#else
var buffer = new ReadOnlySpan<byte>(pv, checked((int)cb));
_dataStream.Write(buffer);
-#endif
if (pcbWritten != null)
*pcbWritten = cb;
/// <summary>
/// Specifies the margins of a printed page.
/// </summary>
-#if netcoreapp || netcoreapp30
+#if NETCOREAPP
[TypeConverter("System.Drawing.Printing.MarginsConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
#endif
public partial class Margins : ICloneable
namespace System.Drawing.Printing
{
-#if !NETCORE
- [DefaultEvent ("PrintPage"), DefaultProperty ("DocumentName")]
- [ToolboxItemFilter ("System.Drawing.Printing", ToolboxItemFilterType.Allow)]
-#endif
public class PrintDocument : System.ComponentModel.Component
{
private PageSettings defaultpagesettings;
}
catch (DllNotFoundException)
{
-#if NETCORE
System.Diagnostics.Debug.WriteLine("libcups not found. To have printing support, you need cups installed");
-#else
- Console.WriteLine("libcups not found. To have printing support, you need cups installed");
-#endif
return false;
}
}
catch (Exception)
{
-#if NETCORE
System.Diagnostics.Debug.WriteLine("There was an error opening the printer {0}. Please check your cups installation.");
-#else
- Console.WriteLine("There was an error opening the printer {0}. Please check your cups installation.");
-#endif
}
return IntPtr.Zero;
}
// we use an internal .ctor to ensure the SystemIcons can't de disposed
private static readonly Icon[] icons = new Icon[6]
{
-#if NETCORE
// TODO: Decide which icons to use for this.
new Icon("placeholder.ico", undisposable:true), // Application_Winlogo
new Icon("placeholder.ico", undisposable:true), // Asterisk_Information
new Icon("placeholder.ico", undisposable:true), // Exclamation_Warning
new Icon("placeholder.ico", undisposable:true), // Question_
new Icon("placeholder.ico", undisposable:true), // Shield_
-#else
- new Icon("Mono.ico", undisposable:true), // Application_Winlogo
- new Icon("Information.ico", undisposable:true), // Asterisk_Information
- new Icon("Error.ico", undisposable:true), // Error_Hand
- new Icon("Warning.ico", undisposable:true), // Exclamation_Warning
- new Icon("Question.ico", undisposable:true), // Question_
- new Icon("Shield.ico", undisposable:true), // Shield_
-#endif
};
// note: same as WinLogo (for Mono)
}
// Test the string overload for a surrogate pair or a single char
GetUnicodeCategory(testCase.Utf32CodeValue, new UnicodeCategory[] { testCase.GeneralCategory });
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(testCase.GeneralCategory, CharUnicodeInfo.GetUnicodeCategory(testCase.CodePoint));
-#endif // netcoreapp
+#endif
}
}
private SynchronizationContext? _synchronizationContext;
private ExecutionContext? _executionContext;
-#if !netstandard
+#if !NETSTANDARD2_0
private CancellationToken CancellationToken => _cancellationTokenRegistration.Token;
#else
private CancellationToken _cancellationToken;
_cancellationTokenRegistration = default;
_synchronizationContext = null;
_executionContext = null;
-#if netstandard
+#if NETSTANDARD2_0
_cancellationToken = CancellationToken.None;
#endif
}
// Don't register if already completed, we would immediately unregistered in ObserveCancellation
if (cancellationToken.CanBeCanceled && !IsCompleted)
{
-#if netstandard
+#if NETSTANDARD2_0
_cancellationToken = cancellationToken;
#endif
_cancellationTokenRegistration = cancellationToken.UnsafeRegister(callback, state);
cancellationToken = CancellationToken;
CancellationTokenRegistration cancellationTokenRegistration = _cancellationTokenRegistration;
-#if netstandard
+#if NETSTANDARD2_0
_cancellationToken = default;
#endif
_cancellationTokenRegistration = default;
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask();
}
-#if !netstandard
+#if !NETSTANDARD2_0
public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default)
{
return ReadAsyncInternal(buffer, cancellationToken);
return GetFlushResultAsTask(valueTask);
}
-#if !netstandard
+#if !NETSTANDARD2_0
public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
{
ValueTask<FlushResult> valueTask = _pipeWriter.WriteAsync(buffer, cancellationToken);
if (!_leaveOpen)
{
-#if !netstandard
+#if !NETSTANDARD2_0
await InnerStream.DisposeAsync().ConfigureAwait(false);
#else
InnerStream.Dispose();
if (returnSegment.Length > 0)
{
-#if !netstandard
+#if !NETSTANDARD2_0
InnerStream.Write(returnSegment.Memory.Span);
#else
InnerStream.Write(returnSegment.Memory);
return 0;
}
-#if netcoreapp
+#if NETCOREAPP
public override async ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default)
{
await WaitForReadTask.Task;
cancellationToken.ThrowIfCancellationRequested();
}
-#if netcoreapp
+#if NETCOREAPP
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
{
await WaitForWriteTask.Task;
return Task.CompletedTask;
}
-#if netcoreapp
+#if NETCOREAPP
public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
{
if (_writes >= _maxWrites)
{
throw new OperationCanceledException();
}
-#if netcoreapp
+#if NETCOREAPP
public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default)
{
throw new OperationCanceledException();
return bytes;
}
-#if netcoreapp
+#if NETCOREAPP
public override async ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
{
if (_throwOnNextCallToRead)
throw new OperationCanceledException();
}
-#if netcoreapp
+#if NETCOREAPP
public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
{
throw new OperationCanceledException();
}
[Theory]
-#if netcoreapp
+#if NETCOREAPP
[InlineData(DecompressionMethods.Brotli, "br", "")]
[InlineData(DecompressionMethods.Brotli, "br", "br")]
[InlineData(DecompressionMethods.Brotli, "br", "gzip")]
}
protected LoopbackServerFactory LoopbackServerFactory =>
-#if netcoreapp
+#if NETCOREAPP
UseHttp2 ?
(LoopbackServerFactory)Http2LoopbackServerFactory.Singleton :
#endif
protected override bool UseSocketsHttpHandler => false;
}
-#if netcoreapp
+#if NETCOREAPP
public sealed class PlatformHandler_HttpClientHandler_Decompression_Tests : HttpClientHandler_Decompression_Test
{
public PlatformHandler_HttpClientHandler_Decompression_Tests(ITestOutputHelper output) : base(output) { }
return TaskTimeoutExtensions.WhenAllOrAnyFailed(tasks, timeoutInMilliseconds);
}
-#if netcoreapp
+#if NETCOREAPP
public static Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> AllowAllCertificates = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
#else
public static Func<HttpRequestMessage, X509Certificate2, X509Chain, SslPolicyErrors, bool> AllowAllCertificates = (_, __, ___, ____) => true;
Assert.Throws<PlatformNotSupportedException>(() => WebSocket.RegisterPrefixes());
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void IsApplicationTargeting45_AlwaysTrue()
{
Assert.True(WebSocket.IsApplicationTargeting45());
#pragma warning restore 0618
}
-#endif // netcoreapp
+#endif
[Theory]
[InlineData(WebSocketState.None)]
Assert.NotNull(propertyInfo);
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void Invoke_Event_Add_And_Remove_And_Raise_Invokes_Correct_Methods()
{
Assert.True(invokedMethods[2] != null && expectedMethod == invokedMethods[2], String.Format("Third invoke should have been {0} but actual was {1}",
expectedMethod.Name, invokedMethods[1]));
}
-#endif // netcoreapp
+#endif
[Fact]
public static void Proxy_Declares_Interface_Events()
public System.Reflection.Metadata.StringHandle Name { get { throw null; } }
public System.Reflection.Metadata.BlobHandle PublicKey { get { throw null; } }
public System.Version Version { get { throw null; } }
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
public System.Reflection.AssemblyName GetAssemblyName() { throw null; }
#endif
public System.Reflection.Metadata.CustomAttributeHandleCollection GetCustomAttributes() { throw null; }
public System.Reflection.Metadata.StringHandle Name { get { throw null; } }
public System.Reflection.Metadata.BlobHandle PublicKeyOrToken { get { throw null; } }
public System.Version Version { get { throw null; } }
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
public System.Reflection.AssemblyName GetAssemblyName() { throw null; }
#endif
public System.Reflection.Metadata.CustomAttributeHandleCollection GetCustomAttributes() { throw null; }
public partial class ImageFormatLimitationException : System.Exception
{
public ImageFormatLimitationException() { }
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
protected ImageFormatLimitationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
#endif
public ImageFormatLimitationException(string message) { }
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLSCompliant>false</CLSCompliant>
- <DefineConstants Condition="'$(TargetGroup)' == 'netstandard1.1'">$(DefineConstants);NETSTANDARD11</DefineConstants>
<Configurations>netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release;netstandard1.1-Debug;netstandard1.1-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release</Configurations>
</PropertyGroup>
<ItemGroup>
<DefaultLanguage>en-US</DefaultLanguage>
<CLSCompliant>false</CLSCompliant>
<TargetsNetCoreAppOrUap Condition="'$(TargetsNetCoreApp)'=='true' OR '$(TargetsUap)' == 'true'">true</TargetsNetCoreAppOrUap>
- <DefineConstants Condition="'$(TargetGroup)' == 'netstandard1.1'">NETSTANDARD11</DefineConstants>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.1'">netstandard1.1;portable-net45+win8</PackageTargetFramework>
<Configurations>netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release;netstandard1.1-Debug;netstandard1.1-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release</Configurations>
</PropertyGroup>
public DisposableData(IDisposable accessor, SafeBuffer safeBuffer, long offset)
{
// Make sure the current thread isn't aborted in between acquiring the pointer and assigning the fields.
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
{
// Make sure the current thread isn't aborted in between zeroing the references and releasing/disposing.
// Safe buffer only frees the underlying resource if its ref count drops to zero, so we have to make sure it does.
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
public DisposableData(int size)
{
// make sure the current thread isn't aborted in between allocating and storing the pointer
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
protected override void Release()
{
// make sure the current thread isn't aborted in between zeroing the pointer and freeing the memory
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
public PinnedObject(object obj)
{
// Make sure the current thread isn't aborted in between allocating the handle and storing it.
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
protected override void Release()
{
// Make sure the current thread isn't aborted in between zeroing the handle and freeing it.
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
protected override void Release()
{
// Make sure the current thread isn't aborted in the middle of the operation.
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
var blobs = GetBlobs();
MemoryBlock result;
-#if !NETSTANDARD11
+#if !NETSTANDARD1_1
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
{
internal static class NetCoreApiEmulators
{
-#if netcoreapp
+#if NETCOREAPP
public static bool IsSZArray(this Type t) => t.IsSZArray;
public static bool IsVariableBoundArray(this Type t) => t.IsVariableBoundArray;
public static bool IsTypeDefinition(this Type t) => t.IsTypeDefinition;
var loadedAssembly1 = Assembly.LoadFile(fullRuntimeTestsPath);
Assert.NotEqual(currentAssembly, loadedAssembly1);
-#if netcoreapp
+#if NETCOREAPP
System.Runtime.Loader.AssemblyLoadContext alc = System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(loadedAssembly1);
string expectedName = string.Format("Assembly.LoadFile({0})", fullRuntimeTestsPath);
Assert.Equal(expectedName, alc.Name);
static int ResourcesAfAZEvents = 0;
-#if netcoreapp
+#if NETCOREAPP
static System.Reflection.Assembly AssemblyResolvingEventHandler(System.Runtime.Loader.AssemblyLoadContext alc, System.Reflection.AssemblyName name)
{
if (name.FullName.StartsWith("System.Resources.ResourceManager.Tests.resources"))
{
if (name.Contains("Culture=af-ZA"))
{
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(1, ResourcesAfAZEvents);
#else
Assert.Equal(0, ResourcesAfAZEvents);
private static void Remote_ExpectEvents()
{
-#if netcoreapp
+#if NETCOREAPP
System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += AssemblyResolvingEventHandler;
#endif
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolveEventHandler);
string actual = resourceManager.GetString("One", culture);
Assert.Equal("Value-One", actual);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(2, ResourcesAfAZEvents);
#else
Assert.Equal(1, ResourcesAfAZEvents);
namespace System.Runtime.Caching
{
- // CoreClr 2.0 supports GC sized refs but does not expose System.SizedReference
-#if NETCOREAPP21
- internal class SRef {
- private static Type s_type = Type.GetType("System.SizedReference", true, false);
- private Object _sizedRef;
-
- internal SRef(Object target) {
- _sizedRef = Activator.CreateInstance(s_type,
- BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.CreateInstance,
- null,
- new object[] { target },
- null);
- }
-
- internal long ApproximateSize {
- get {
- object o = s_type.InvokeMember("ApproximateSize",
- BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty,
- null, // binder
- _sizedRef, // target
- null, // args
- CultureInfo.InvariantCulture);
- return (long)o;
- }
- }
-
- internal void Dispose() {
- s_type.InvokeMember("Dispose",
- BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod,
- null, // binder
- _sizedRef, // target
- null, // args
- CultureInfo.InvariantCulture);
- }
- }
-
- internal class SRefMultiple {
- private SRef[] _srefs;
- private long[] _sizes; // Getting SRef size in the debugger is extremely tedious so we keep the last read value here
-
- internal SRefMultiple(object[] targets) {
- _srefs = new SRef[targets.Length];
- _sizes = new long[targets.Length];
- for (int i = 0; i < targets.Length; i++) {
- _srefs[i] = new SRef(targets[i]);
- }
- }
-
- internal long ApproximateSize {
- get {
- long size = 0;
- for (int i = 0; i < _srefs.Length; i++) {
- size += (_sizes[i] = _srefs[i].ApproximateSize);
- }
- return size;
- }
- }
-
- internal void Dispose() {
- foreach (SRef s in _srefs) {
- s.Dispose();
- }
- }
- }
-
-#else
// until then we provide a stub
internal class SRefMultiple
{
{
}
}
-#endif
internal class GCHandleRef<T> : IDisposable
where T : class, IDisposable
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public void TestUTF8String()
{
using System.Diagnostics.Eventing.Reader;
// System.Text.Json is a .NET Core 3.0 specific library
-#if netcoreapp
+#if NETCOREAPP
using System.Text.Json;
#endif
var isolatedStorageException = new IsolatedStorageException("message", exception);
yield return new object[] { PopulateException(isolatedStorageException), new TypeSerializableValue[] { new TypeSerializableValue("AAEAAAD/////AQAAAAAAAAAEAQAAADJTeXN0ZW0uSU8uSXNvbGF0ZWRTdG9yYWdlLklzb2xhdGVkU3RvcmFnZUV4Y2VwdGlvbgwAAAAJQ2xhc3NOYW1lB01lc3NhZ2UERGF0YQ5Jbm5lckV4Y2VwdGlvbgdIZWxwVVJMEFN0YWNrVHJhY2VTdHJpbmcWUmVtb3RlU3RhY2tUcmFjZVN0cmluZxBSZW1vdGVTdGFja0luZGV4D0V4Y2VwdGlvbk1ldGhvZAdIUmVzdWx0BlNvdXJjZQ1XYXRzb25CdWNrZXRzAQEDAwEBAQABAAEHKVN5c3RlbS5Db2xsZWN0aW9ucy5MaXN0RGljdGlvbmFyeUludGVybmFsEFN5c3RlbS5FeGNlcHRpb24ICAIGAgAAADJTeXN0ZW0uSU8uSXNvbGF0ZWRTdG9yYWdlLklzb2xhdGVkU3RvcmFnZUV4Y2VwdGlvbgYDAAAAB21lc3NhZ2UJBAAAAAkFAAAABgYAAAAZaHR0cDovL21zZG4ubWljcm9zb2Z0LmNvbQYHAAAAFFN0YWNrVHJhY2Ugc3RyaW5nLi4uBggAAAAbUmVtb3RlIFN0YWNrVHJhY2Ugc3RyaW5nLi4uAAAAAAroAwAABgkAAAAXRXhjZXB0aW9uX0NsYXNzX1NhbXBsZXMKBAQAAAApU3lzdGVtLkNvbGxlY3Rpb25zLkxpc3REaWN0aW9uYXJ5SW50ZXJuYWwDAAAABGhlYWQHdmVyc2lvbgVjb3VudAMAADhTeXN0ZW0uQ29sbGVjdGlvbnMuTGlzdERpY3Rpb25hcnlJbnRlcm5hbCtEaWN0aW9uYXJ5Tm9kZQgICQoAAAACAAAAAgAAAAQFAAAAEFN5c3RlbS5FeGNlcHRpb24MAAAACUNsYXNzTmFtZQdNZXNzYWdlBERhdGEOSW5uZXJFeGNlcHRpb24HSGVscFVSTBBTdGFja1RyYWNlU3RyaW5nFlJl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pb25hcnlOb2RlAwAAAANrZXkFdmFsdWUEbmV4dAICAzhTeXN0ZW0uQ29sbGVjdGlvbnMuTGlzdERpY3Rpb25hcnlJbnRlcm5hbCtEaWN0aW9uYXJ5Tm9kZQYTAAAABnNlY3JldAgBAQkUAAAAAQ0AAAAEAAAACRUAAAACAAAAAgAAAAEOAAAABQAAAAkLAAAABhcAAAAXSW5uZXIgZXhjZXB0aW9uIG1lc3NhZ2UKCgoKCgAAAAAKABUTgAoKARQAAAAKAAAACAgBAAAABhgAAAADb25lCgEVAAAACgAAAAkTAAAACAEBCRoAAAABGgAAAAoAAAAICAEAAAAJGAAAAAoL", TargetFrameworkMoniker.netfx461) } };
-#if netcoreapp
+#if NETCOREAPP
var jsonException = new JsonException("message", path: "path", lineNumber: 1, bytePositionInLine: 2, innerException: exception);
yield return new object[] { PopulateException(jsonException), new TypeSerializableValue[] { new TypeSerializableValue("AAEAAAD/////AQAAAAAAAAAMAgAAAFNTeXN0ZW0uVGV4dC5Kc29uLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Y2M3YjEzZmZjZDJkZGQ1MQUBAAAAHlN5c3RlbS5UZXh0Lkpzb24uSnNvbkV4Y2VwdGlvbhAAAAAJQ2xhc3NOYW1lB01lc3NhZ2UERGF0YQ5Jbm5lckV4Y2VwdGlvbgdIZWxwVVJMEFN0YWNrVHJhY2VTdHJpbmcWUmVtb3RlU3RhY2tUcmFjZVN0cmluZxBSZW1vdGVTdGFja0luZGV4D0V4Y2VwdGlvbk1ldGhvZAdIUmVzdWx0BlNvdXJjZQ1XYXRzb25CdWNrZXRzCkxpbmVOdW1iZXISQnl0ZVBvc2l0aW9uSW5MaW5lBFBhdGgNQWN0dWFsTWVzc2FnZQEBAwMBAQEAAQABBwMDAQEpU3lzdGVtLkNvbGxlY3Rpb25zLkxpc3REaWN0aW9uYXJ5SW50ZXJuYWwQU3lzdGVtLkV4Y2VwdGlvbggIAg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YWx1ZQRuZXh0AgIDOFN5c3RlbS5Db2xsZWN0aW9ucy5MaXN0RGljdGlvbmFyeUludGVybmFsK0RpY3Rpb25hcnlOb2RlBhYAAAAGc2VjcmV0CAEBCRcAAAABEAAAAAUAAAAJGAAAAAIAAAACAAAAAREAAAAGAAAACQ4AAAAGGgAAABdJbm5lciBleGNlcHRpb24gbWVzc2FnZQoKCgoKAAAAAAoAFROACgoBFwAAAA0AAAAICAEAAAAGGwAAAANvbmUKARgAAAANAAAACRYAAAAIAQEJHQAAAAEdAAAADQAAAAgIAQAAAAkbAAAACgs=", TargetFrameworkMoniker.netcoreapp30) } };
var smtpFailedRecipientsException = new SmtpFailedRecipientsException("message", new SmtpFailedRecipientException[] { smtpFailedRecipientException });
yield return new object[] { PopulateException(smtpFailedRecipientsException), new TypeSerializableValue[] { new TypeSerializableValue("AAEAAAD/////AQAAAAAAAAAMAgAAAElTeXN0ZW0sIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAtU3lzdGVtLk5ldC5NYWlsLlNtdHBGYWlsZWRSZWNpcGllbnRzRXhjZXB0aW9uDwAAAAlDbGFzc05hbWUHTWVzc2FnZQREYXRhDklubmVyRXhjZXB0aW9uB0hlbHBVUkwQU3RhY2tUcmFjZVN0cmluZxZSZW1vdGVTdGFja1RyYWNlU3RyaW5nEFJlbW90ZVN0YWNrSW5kZXgPRXhjZXB0aW9uTWV0aG9kB0hSZXN1bHQGU291cmNlDVdhdHNvbkJ1Y2tldHMGU3RhdHVzD2ZhaWxlZFJlY2lwaWVudA9pbm5lckV4Y2VwdGlvbnMBAQMEAQEBAAEAAQcAAQQpU3lzdGVtLkNvbGxlY3Rpb25zLkxpc3REaWN0aW9uYXJ5SW50ZXJuYWwsU3lzdGVtLk5ldC5NYWlsLlNtdHBGYWlsZWRSZWNpcGllbnRFeGNlcHRpb24CAAAACAgCCC5TeX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ERpY3Rpb25hcnlJbnRlcm5hbBBTeXN0ZW0uRXhjZXB0aW9uCAgCCAIAAAAGDgAAACxTeXN0ZW0uTmV0Lk1haWwuU210cEZhaWxlZFJlY2lwaWVudEV4Y2VwdGlvbgYPAAAAMkNvbXBsZXRlZC4gVGhlIHNlcnZlciByZXNwb25zZSB3YXM6IHNlcnZlclJlc3BvbnNlCRAAAAAKCQcAAAAJCAAAAAkJAAAAAAAAAAroAwAACQoAAAAK+gAAAAkLAAAABwwAAAAAAQAAAAEAAAAELFN5c3RlbS5OZXQuTWFpbC5TbXRwRmFpbGVkUmVjaXBpZW50RXhjZXB0aW9uAgAAAAkGAAAABA0AAAA4U3lzdGVtLkNvbGxlY3Rpb25zLkxpc3REaWN0aW9uYXJ5SW50ZXJuYWwrRGljdGlvbmFyeU5vZGUDAAAAA2tleQV2YWx1ZQRuZXh0AgIDOFN5c3RlbS5Db2xsZWN0aW9ucy5MaXN0RGljdGlvbmFyeUludGVybmFsK0RpY3Rpb25hcnlOb2RlBhcAAAAGc2VjcmV0CAEBCRgAAAABEAAAAAUAAAAJGQAAAAIAAAACAAAAARgAAAANAAAACAgBAAAABhoAAAADb25lCgEZAAAADQAAAAkXAAAACAEBCRwAAAABHAAAAA0AAAAICAEAAAAJGgAAAAoL", TargetFrameworkMoniker.netfx461) } };
-#if netcoreapp
+#if NETCOREAPP
var ambiguousImplementationException = new AmbiguousImplementationException();
yield return new object[] { PopulateException(ambiguousImplementationException, false), new TypeSerializableValue[] { new TypeSerializableValue("AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uUnVudGltZSwgVmVyc2lvbj00LjIuMS4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAAC9TeXN0ZW0uUnVudGltZS5BbWJpZ3VvdXNJbXBsZW1lbnRhdGlvbkV4Y2VwdGlvbgwAAAAJQ2xhc3NOYW1lB01lc3NhZ2UERGF0YQ5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ionException(34);
using Xunit;
// System.Text.Json is a .NET Core 3.0 specific library
-#if netcoreapp
+#if NETCOREAPP
using System.Text.Json;
#endif
@this.InnerExceptions.CheckSequenceEquals(other.InnerExceptions, isSamePlatform);
}
-#if netcoreapp
+#if NETCOREAPP
public static void IsEqual(this JsonException @this, JsonException other, bool isSamePlatform)
{
if (@this == null && other == null)
(libpath[packagepath.Length] == '\\' || packagepath.EndsWith("\\"));
}
-#if netstandard
+#if NETSTANDARD2_0
/* Returns true if libpath is path to an ni image and if the path contains packagename as a subfolder */
private static bool LibpathContainsPackagename(string libpath, string packagename)
{
}
}
-#if netstandard
+#if NETSTANDARD2_0
/* On phone libpath is usually ni path and not IL path as we do not touch the IL on phone.
On Phone NI images are no longer under package root. Due to this above logic fails to
find the package to which the library belongs. We assume that NI paths usually have
{
string packageSimpleName = FindPackageSimpleNameForFilename(libpath);
-#if netstandard
+#if NETSTANDARD2_0
// If we have found a simple package name for the assembly, lets make sure it is not *.resource.dll that
// an application may have packaged in its AppX. This is to enforce AppX apps to use PRI resources.
if (packageSimpleName != null)
packageSimpleName = null;
}
}
-#endif // netstandard
+#endif
if (packageSimpleName != null)
{
ResourceMap packageResourceMap = null;
Assert.Throws<AmbiguousMatchException>(() => Activator.CreateInstance(typeof(Choice1), new object[] { null }));
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public void CreateInstance_NotRuntimeType_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>("type", () => Activator.CreateInstance(nonRuntimeType, new object[0]));
}
}
-#endif // netcoreapp
+#endif
public static IEnumerable<object[]> CreateInstance_ContainsGenericParameters_TestData()
{
yield return new object[] { ulong.MinValue.ToString(), false, (UInt64Enum)ulong.MinValue };
yield return new object[] { ulong.MaxValue.ToString(), false, (UInt64Enum)ulong.MaxValue };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { "Value1", false, Enum.ToObject(s_charEnumType, (char)1) };
yield return new object[] { "vaLue2", true, Enum.ToObject(s_charEnumType, (char)2) };
yield return new object[] { "Value1", false, Enum.GetValues(s_doubleEnumType).GetValue(0) };
yield return new object[] { "vaLue2", true, Enum.GetValues(s_doubleEnumType).GetValue(0) };
}
-#endif // netcoreapp
+#endif
// SimpleEnum
yield return new object[] { "Red", false, SimpleEnum.Red };
yield return new object[] { typeof(UInt64Enum), "-1", false, typeof(OverflowException) };
yield return new object[] { typeof(UInt64Enum), "18446744073709551616", false, typeof(OverflowException) };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { s_charEnumType, ((char)1).ToString(), false, typeof(ArgumentException) };
yield return new object[] { s_charEnumType, ((char)5).ToString(), false, typeof(ArgumentException) };
// UIntPtr
yield return new object[] { s_uintPtrEnumType, "1", false, typeof(InvalidCastException) };
yield return new object[] { s_uintPtrEnumType, "5", false, typeof(InvalidCastException) };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { typeof(UInt64Enum), ulong.MaxValue, "Max" };
yield return new object[] { typeof(UInt64Enum), 3UL, null };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { s_charEnumType, Enum.Parse(s_charEnumType, "Value1"), "Value1" };
yield return new object[] { s_charEnumType, Enum.Parse(s_charEnumType, "Value2"), "Value2" };
yield return new object[] { s_boolEnumType, Enum.Parse(s_boolEnumType, "Value2"), "Value2" };
yield return new object[] { s_boolEnumType, true, "Value1" };
yield return new object[] { s_boolEnumType, false, "Value2" };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { typeof(UInt64Enum), (ulong)1, true };
yield return new object[] { typeof(UInt64Enum), (ulong)99, false };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { s_charEnumType, "Value1", true };
yield return new object[] { s_charEnumType, "None", false };
yield return new object[] { s_boolEnumType, "Value1", true };
yield return new object[] { s_boolEnumType, true, true };
yield return new object[] { s_boolEnumType, false, true };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x0010, false };
yield return new object[] { (UInt64Enum)0x3f06, (UInt64Enum)0x3f16, false };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x3000"), true };
yield return new object[] { Enum.Parse(s_charEnumType, "Value0x3f06"), Enum.Parse(s_charEnumType, "Value0x0f06"), true };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 0x3f06), Enum.ToObject(s_uintPtrEnumType, 0x3f06), true };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 0x3f06), Enum.ToObject(s_uintPtrEnumType, 0x0010), false };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 0x3f06), Enum.ToObject(s_uintPtrEnumType, 0x3f16), false };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { typeof(UInt64Enum), (ulong)77, (UInt64Enum)77 };
yield return new object[] { typeof(UInt64Enum), (ulong)0x0123456789abcdefL, (UInt64Enum)0x0123456789abcdefL };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { s_charEnumType, (char)1, Enum.Parse(s_charEnumType, "Value1") };
yield return new object[] { s_charEnumType, (char)2, Enum.Parse(s_charEnumType, "Value2") };
// Bool
yield return new object[] { s_boolEnumType, true, Enum.Parse(s_boolEnumType, "Value1") };
yield return new object[] { s_boolEnumType, false, Enum.Parse(s_boolEnumType, "Value2") };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { null, typeof(ArgumentNullException) };
yield return new object[] { typeof(Enum), typeof(ArgumentException) };
yield return new object[] { typeof(object), typeof(ArgumentException) };
-#if netcoreapp
+#if NETCOREAPP
yield return new object[] { GetNonRuntimeEnumTypeBuilder(typeof(int)), typeof(ArgumentException) };
-#endif // netcoreapp
+#endif
}
[Theory]
{
yield return new object[] { typeof(SimpleEnum), null, typeof(ArgumentNullException) };
yield return new object[] { typeof(SimpleEnum), "Hello", typeof(ArgumentException) };
-#if netcoreapp
+#if NETCOREAPP
yield return new object[] { s_floatEnumType, 1.0f, typeof(ArgumentException) };
yield return new object[] { s_doubleEnumType, 1.0, typeof(ArgumentException) };
yield return new object[] { s_intPtrEnumType, (IntPtr)1, typeof(ArgumentException) };
yield return new object[] { s_uintPtrEnumType, (UIntPtr)1, typeof(ArgumentException) };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { UInt64Enum.One, new object(), false };
yield return new object[] { UInt64Enum.One, null, false };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), Enum.Parse(s_charEnumType, "Value1"), true };
yield return new object[] { Enum.Parse(s_charEnumType, "Value1"), Enum.Parse(s_charEnumType, "Value2"), false };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 1), (UIntPtr)1, false };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 1), new object(), false };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 1), null, false };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { UInt64Enum.One, UInt64Enum.Max, -1 };
yield return new object[] { UInt64Enum.One, null, 1 };
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[] { Enum.Parse(s_charEnumType, "Value2"), Enum.Parse(s_charEnumType, "Value2"), 0 };
yield return new object[] { Enum.Parse(s_charEnumType, "Value2"), Enum.Parse(s_charEnumType, "Value1"), 1 };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 1), Enum.ToObject(s_uintPtrEnumType, 2), -1 };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 3), Enum.ToObject(s_uintPtrEnumType, 2), 1 };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 1), null, 1 };
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { typeof(UInt32Enum), typeof(uint) };
yield return new object[] { typeof(Int64Enum), typeof(long) };
yield return new object[] { typeof(UInt64Enum), typeof(ulong) };
-#if netcoreapp
+#if NETCOREAPP
yield return new object[] { s_charEnumType, typeof(char) };
yield return new object[] { s_boolEnumType, typeof(bool) };
yield return new object[] { s_floatEnumType, typeof(float) };
yield return new object[] { s_doubleEnumType, typeof(double) };
yield return new object[] { s_intPtrEnumType, typeof(IntPtr) };
yield return new object[] { s_uintPtrEnumType, typeof(UIntPtr) };
-#endif // netcoreapp
+#endif
}
[Theory]
new object[] { UInt64Enum.Min, UInt64Enum.One, UInt64Enum.Two, UInt64Enum.Max }
};
-#if netcoreapp
+#if NETCOREAPP
// Char
yield return new object[]
{
new string[0],
new object[0]
};
-#endif // netcoreapp
+#endif
}
[Theory]
yield return new object[] { (UInt64Enum)99, "D", "99" };
yield return new object[] { UInt64Enum.Max, "D", "18446744073709551615" };
-#if netcoreapp
+#if NETCOREAPP
// "D": Char
yield return new object[] { Enum.ToObject(s_charEnumType, (char)0), "D", ((char)0).ToString() };
yield return new object[] { Enum.ToObject(s_charEnumType, (char)1), "D", ((char)1).ToString() };
yield return new object[] { Enum.ToObject(s_doubleEnumType, 0), "D", "0" };
yield return new object[] { Enum.ToObject(s_doubleEnumType, 1), "D", double.Epsilon.ToString() };
yield return new object[] { Enum.ToObject(s_doubleEnumType, long.MaxValue), "D", double.NaN.ToString() };
-#endif // netcoreapp
+#endif
// "D": SimpleEnum
yield return new object[] { SimpleEnum.Red, "D", "1" };
yield return new object[] { (UInt64Enum)99, "X", "0000000000000063" };
yield return new object[] { UInt64Enum.Max, "X", "FFFFFFFFFFFFFFFF" };
-#if netcoreapp
+#if NETCOREAPP
// "X": Char
yield return new object[] { Enum.ToObject(s_charEnumType, (char)0), "X", "0000" };
yield return new object[] { Enum.ToObject(s_charEnumType, (char)1), "X", "0001" };
yield return new object[] { Enum.ToObject(s_boolEnumType, false), "X", "00" };
yield return new object[] { Enum.ToObject(s_boolEnumType, true), "X", "01" };
yield return new object[] { Enum.ToObject(s_boolEnumType, 123), "X", "01" };
-#endif // netcoreapp
+#endif
// "X": SimpleEnum
yield return new object[] { SimpleEnum.Red, "X", "00000001" };
yield return new object[] { (UInt64Enum)5, "F", "5" };
yield return new object[] { UInt64Enum.Max, "F", "Max" };
-#if netcoreapp
+#if NETCOREAPP
// "F": Char
yield return new object[] { Enum.ToObject(s_charEnumType, (char)1), "F", "Value1" };
yield return new object[] { Enum.ToObject(s_charEnumType, (char)(1 | 2)), "F", "Value1, Value2" };
// "F": UIntPtr
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 5), "F", "5" };
-#endif // netcoreapp
+#endif
// "F": SimpleEnum
yield return new object[] { SimpleEnum.Red, "F", "Red" };
// "F": Flags Attribute
yield return new object[] { AttributeTargets.Class | AttributeTargets.Delegate, "F", "Class, Delegate" };
-#if netcoreapp
+#if NETCOREAPP
// "G": Char
yield return new object[] { Enum.ToObject(s_charEnumType, char.MaxValue), "G", char.MaxValue.ToString() };
#endif
public static IEnumerable<object[]> UnsupportedEnumType_TestData()
{
-#if netcoreapp
+#if NETCOREAPP
yield return new object[] { s_floatEnumType, 1.0f };
yield return new object[] { s_doubleEnumType, 1.0 };
yield return new object[] { s_intPtrEnumType, (IntPtr)1 };
yield return new object[] { s_uintPtrEnumType, (UIntPtr)1 };
#else
return Array.Empty<object[]>();
-#endif //netcoreapp
+#endif
}
[Theory]
public static IEnumerable<object[]> UnsupportedEnum_TestData()
{
-#if netcoreapp
+#if NETCOREAPP
yield return new object[] { Enum.ToObject(s_floatEnumType, 1) };
yield return new object[] { Enum.ToObject(s_doubleEnumType, 2) };
yield return new object[] { Enum.ToObject(s_intPtrEnumType, 1) };
yield return new object[] { Enum.ToObject(s_uintPtrEnumType, 2) };
#else
return Array.Empty<object[]>();
-#endif //netcoreapp
+#endif
}
[Theory]
public DSA Create(int keySize)
{
-#if netcoreapp
+#if NETCOREAPP
return DSA.Create(keySize);
#else
DSA dsa = Create();
return ec;
}
-#if netcoreapp
+#if NETCOREAPP
public ECDsa Create(ECCurve curve)
{
return ECDsa.Create(curve);
public RSA Create(int keySize)
{
-#if netcoreapp
+#if NETCOREAPP
return RSA.Create(keySize);
#else
RSA rsa = Create();
Assert.Throws<ArgumentOutOfRangeException>(() => new Rfc2898DeriveBytes(TestPassword, s_testSalt, int.MinValue / 2));
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void Ctor_EmptyAlgorithm()
{
});
}
-#if netcoreapp
+#if NETCOREAPP
[Theory]
[MemberData(nameof(KnownValuesTestCases))]
public static void GetBytes_KnownValues_WithAlgorithm(KnownValuesTestCase testCase)
return new ECDiffieHellmanCng(keySize);
}
-#if netcoreapp
+#if NETCOREAPP
public ECDiffieHellman Create(ECCurve curve)
{
return new ECDiffieHellmanCng(curve);
return new ECDiffieHellmanCng();
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void ECCurve_ctor()
{
}
}
-#if netcoreapp
+#if NETCOREAPP
[ConditionalTheory(nameof(ECExplicitCurvesSupported)), MemberData(nameof(TestCurves))]
public static void TestHashRoundTrip(CurveDef curveDef)
{
Assert.Equal(0xFF, param2.Curve.Seed[0]);
}
}
-#endif // netcoreapp
+#endif
}
}
return new ECDsaCng(keySize);
}
-#if netcoreapp
+#if NETCOREAPP
public ECDsa Create(ECCurve curve)
{
return new ECDsaCng(curve);
Assert.Equal(CngAlgorithm.Sha256, cng.HashAlgorithm);
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void TestPositive256WithBlob()
{
Assert.Equal(algorithm, cng.Key.Algorithm);
}
}
-#endif // netcoreapp
+#endif
public static IEnumerable<object[]> SpecialNistKeys
{
}
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void SafeNCryptKeyHandle_ParentHandle_Invalid()
{
return null;
}
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
byte[] cek = null;
int cekLength = 0;
return (T)(object)certificate.GetRSAPrivateKey();
if (typeof(T) == typeof(ECDsa))
return (T)(object)certificate.GetECDsaPrivateKey();
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
if (typeof(T) == typeof(DSA))
return (T)(object)certificate.GetDSAPrivateKey();
#endif
{
private static readonly byte[] s_pSpecifiedDefaultParameters = { 0x04, 0x00 };
-#if !netcoreapp && !netcoreapp30 && !netstandard21
+#if !NETCOREAPP && !NETSTANDARD2_1
// Compatibility API.
internal static void AppendData(this IncrementalHash hasher, ReadOnlySpan<byte> data)
{
return ToUpperHexString(serialBytes);
}
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
private static unsafe string ToUpperHexString(ReadOnlySpan<byte> ba)
{
fixed (byte* baPtr = ba)
attributeObject = Upgrade<Pkcs9MessageDigest>(attributeObject);
break;
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
case Oids.LocalKeyId:
attributeObject = Upgrade<Pkcs9LocalKeyId>(attributeObject);
break;
{
}
-#if netstandard
+#if NETSTANDARD2_0
internal
#else
public
RSAEncryptionPadding = rsaEncryptionPadding ?? throw new ArgumentNullException(nameof(rsaEncryptionPadding));
}
-#if netstandard
+#if NETSTANDARD2_0
internal
#else
public
Certificate = certificate;
}
-#if netstandard
+#if NETSTANDARD2_0
internal
#else
public
}
internal override bool VerifySignature(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> valueHash,
ReadOnlyMemory<byte> signature,
#else
DSAParameters dsaParameters = dsa.ExportParameters(false);
int bufSize = 2 * dsaParameters.Q.Length;
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
byte[] rented = CryptoPool.Rent(bufSize);
Span<byte> ieee = new Span<byte>(rented, 0, bufSize);
}
return dsa.VerifySignature(valueHash, ieee);
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
}
finally
{
}
protected override bool Sign(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> dataHash,
#else
byte[] dataHash,
signatureAlgorithm = new Oid(oidValue, oidValue);
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
// The Q size cannot be bigger than the KeySize.
byte[] rented = CryptoPool.Rent(dsa.KeySize / 8);
int bytesWritten = 0;
}
internal override bool VerifySignature(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> valueHash,
ReadOnlyMemory<byte> signature,
#else
bufSize = 2 * fieldSize;
}
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
byte[] rented = CryptoPool.Rent(bufSize);
Span<byte> ieee = new Span<byte>(rented, 0, bufSize);
}
return key.VerifyHash(valueHash, ieee);
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
}
finally
{
}
protected override bool Sign(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> dataHash,
#else
byte[] dataHash,
signatureAlgorithm = new Oid(oidValue, oidValue);
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
int bufSize;
checked
{
#endif
signatureValue = DsaIeeeToDer(key.SignHash(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
dataHash.ToArray()
#else
dataHash
}
internal override bool VerifySignature(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> valueHash,
ReadOnlyMemory<byte> signature,
#else
return publicKey.VerifyHash(
valueHash,
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
signature.Span,
#else
signature,
}
protected override bool Sign(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> dataHash,
#else
byte[] dataHash,
signatureAlgorithm = new Oid(Oids.Rsa, Oids.Rsa);
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
byte[] signature = new byte[privateKey.KeySize / 8];
bool signed = privateKey.TrySignHash(
}
#endif
signatureValue = privateKey.SignHash(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
dataHash.ToArray(),
#else
dataHash,
}
protected override bool Sign(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> dataHash,
#else
byte[] dataHash,
protected abstract bool VerifyKeyType(AsymmetricAlgorithm key);
internal abstract bool VerifySignature(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> valueHash,
ReadOnlyMemory<byte> signature,
#else
X509Certificate2 certificate);
protected abstract bool Sign(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> dataHash,
#else
byte[] dataHash,
}
internal static bool Sign(
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
ReadOnlySpan<byte> dataHash,
#else
byte[] dataHash,
{
writer.PushSequence();
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
// r
BigInteger val = new BigInteger(
ieeeSignature.Slice(0, fieldSize),
{
}
- // This can be implemented with netcoreapp20 with the cert creation API.
+ // This can be implemented with NETCOREAPP2_0 with the cert creation API.
// * Open the parameters as RSACSP (RSA PKCS#1 signature was hard-coded in netfx)
// * Which will fail on non-Windows
// * Create a certificate with subject CN=CMS Signer Dummy Certificate
{
writer.PopSequence();
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
Span<byte> setOfTag = stackalloc byte[1];
setOfTag[0] = 0x31;
{
writer.PopSetOf();
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
hasher.AppendData(writer.EncodeAsSpan());
#else
hasher.AppendData(writer.Encode());
return false;
}
-#if netcoreapp || netcoreapp30 || netstandard21
+#if NETCOREAPP || NETSTANDARD2_1
// SHA-2-512 is the biggest digest type we know about.
Span<byte> digestValue = stackalloc byte[512 / 8];
ReadOnlySpan<byte> digest = digestValue;
// Prefer ephemeral when available
private static X509KeyStorageFlags GetBestKeyStorageFlags()
{
-#if netcoreapp
+#if NETCOREAPP
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// On Windows 7 ephemeral keys with a key usage embedded in the PFX
internal override CertLoader CloneAsEphemeralLoader()
{
-#if netcoreapp
+#if NETCOREAPP
return new CertLoaderFromRawData(CerData, PfxData, Password)
{
KeyStorageFlags = X509KeyStorageFlags.EphemeralKeySet,
if (cert == null)
return; // Sorry - CertLoader is not configured to load certs with private keys - we've tested as much as we can.
-#if netcoreapp // API not present on netfx
+#if NETCOREAPP // API not present on netfx
if (_useExplicitPrivateKey)
{
using (X509Certificate2 pubCert = certLoader.GetCertificate())
[Theory]
[OuterLoop(/* Leaks key on disk if interrupted */)]
[InlineData(false)]
-#if netcoreapp // API not supported on netfx
+#if NETCOREAPP // API not supported on netfx
[InlineData(true)]
#endif
public static void PostDecrypt_Encode(bool useExplicitPrivateKey)
if (useExplicitPrivateKey)
{
-#if netcoreapp
+#if NETCOREAPP
ecms.Decrypt(r[0], cer.GetRSAPrivateKey());
#else
Assert.True(false, "Should not run on this platform");
[Theory]
[OuterLoop(/* Leaks key on disk if interrupted */)]
[InlineData(false)]
-#if netcoreapp // API not supported on netfx
+#if NETCOREAPP // API not supported on netfx
[InlineData(true)]
#endif
public static void PostDecrypt_Decrypt(bool useExplicitPrivateKey)
{
if (useExplicitPrivateKey)
{
-#if netcoreapp
+#if NETCOREAPP
ecms.Decrypt(r[0], cert1.GetRSAPrivateKey());
#else
Assert.True(false, "Should not run on this platform");
Assert.NotSame(cms.Certificates[0], firstSigner.Certificate);
Assert.Equal(cms.Certificates[0], firstSigner.Certificate);
-#if netcoreapp
+#if NETCOREAPP
byte[] signature = firstSigner.GetSignature();
Assert.NotEmpty(signature);
// DSA PKIX signature format is a DER SEQUENCE.
Assert.Equal(identifierType, cms.SignerInfos[0].SignerIdentifier.Type);
Assert.Equal(firstSigner.Certificate, cms.SignerInfos[0].Certificate);
-#if netcoreapp
+#if NETCOREAPP
byte[] sig2 = cms.SignerInfos[0].GetSignature();
Assert.Equal(signature, sig2);
#endif
Assert.NotSame(cms.Certificates[0], firstSigner.Certificate);
Assert.Equal(cms.Certificates[0], firstSigner.Certificate);
-#if netcoreapp
+#if NETCOREAPP
byte[] signature = firstSigner.GetSignature();
Assert.NotEmpty(signature);
// ECDSA PKIX signature format is a DER SEQUENCE.
Assert.Equal(identifierType, cms.SignerInfos[0].SignerIdentifier.Type);
Assert.Equal(firstSigner.Certificate, cms.SignerInfos[0].Certificate);
-#if netcoreapp
+#if NETCOREAPP
byte[] sig2 = cms.SignerInfos[0].GetSignature();
Assert.Equal(signature, sig2);
#endif
Assert.Equal(2, cms.SignerInfos.Count);
// One of them is a V3 signer, so the whole document is V3.
-#if netfx
+#if NETFRAMEWORK
// Windows CMS computes the version on the first signer, and doesn't
// seem to lift it on the second one.
// It encoded the message as
{
#endif
Assert.Equal(3, cms.Version);
-#if netfx
+#if NETFRAMEWORK
}
#endif
cms.ComputeSignature(signer);
bool ExpectCopyRemoved =
-#if !netfx
+#if !NETFRAMEWORK
true
#else
false
Assert.Equal(SubjectIdentifierType.SubjectKeyIdentifier, signer.SignerIdentifier.Type);
Assert.Equal("1063CAB14FB14C47DC211C0E0285F3EE5946BF2D", signer.SignerIdentifier.Value);
Assert.Equal("2.16.840.1.101.3.4.2.1", signer.DigestAlgorithm.Value);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal("1.2.840.113549.1.1.10", signer.SignatureAlgorithm.Value);
#endif
"082A864886F70D0302020128",
signedAttrs[3].Values[0].RawData.ByteArrayToHex());
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(
"B93E81D141B3C9F159AB0021910635DC72E8E860BE43C28E5D53243D6DC247B7" +
"D4F18C20195E80DEDCC75B29C43CE5047AD775B65BFC93589BD748B950C68BAD" +
Assert.Equal(SubjectIdentifierType.IssuerAndSerialNumber, signer.SignerIdentifier.Type);
Assert.Equal(Oids.Sha1, signer.DigestAlgorithm.Value);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(Oids.Rsa, signer.SignatureAlgorithm.Value);
Assert.Equal(
Assert.Equal(SubjectIdentifierType.IssuerAndSerialNumber, signer.SignerIdentifier.Type);
Assert.Equal(Oids.Sha1, signer.DigestAlgorithm.Value);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(Oids.Rsa, signer.SignatureAlgorithm.Value);
Assert.Equal(
Assert.Null(signer.Certificate);
Assert.Equal(Oids.Sha1, signer.DigestAlgorithm.Value);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal("1.3.6.1.5.5.7.6.2", signer.SignatureAlgorithm.Value);
Assert.Equal(
"833378066BDCCBA7047EF6919843D181A57D6479",
csMessageDigest.MessageDigest.ByteArrayToHex());
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(Oids.Rsa, counterSigner.SignatureAlgorithm.Value);
Assert.Equal(
Assert.Empty(signer.CounterSignerInfos);
Assert.Null(signer.Certificate);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(Oids.Rsa, signer.SignatureAlgorithm.Value);
Assert.Equal(
Assert.Equal(SubjectIdentifierType.IssuerAndSerialNumber, signer.SignerIdentifier.Type);
Assert.Equal(Oids.Sha1, signer.DigestAlgorithm.Value);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(Oids.Rsa, signer.SignatureAlgorithm.Value);
Assert.Equal(
// Assert.NotThrows
cms.CheckSignature(true);
-#if netcoreapp
+#if NETCOREAPP
Assert.Equal(
"1AA282DBED4D862D7CEA30F803E790BDB0C97EE852778CEEDDCD94BB9304A155" +
"2E60A8D36052AC8C2D28755F3B2F473824100AB3A6ABD4C15ABD77E0FFE13D0D" +
Assert.NotSame(counterSigner.Certificate, counterSigner2.Certificate);
Assert.Equal(counterSigner.Certificate, counterSigner2.Certificate);
-#if netcoreapp
+#if NETCOREAPP
byte[] signature = counterSigner.GetSignature();
byte[] signature2 = counterSigner2.GetSignature();
}
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void SignerInfo_GetSignature_UniquePerCall()
{
Assert.NotSame(oid, oid2);
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void SignerInfo_SignatureAlgorithm_NotSame()
{
// content-type attribute even for counter-signers.
int expectedAttrCount = 1;
// One of them is a V3 signer.
-#if netfx
+#if NETFRAMEWORK
expectedAttrCount = 2;
#endif
Assert.Equal(expectedAttrCount, counterSigner.SignedAttributes.Count);
// On NetFx there will be two attributes, because Windows emits the
// content-type attribute even for counter-signers.
int expectedCount = 1;
-#if netfx
+#if NETFRAMEWORK
expectedCount = 2;
#endif
Assert.Equal(expectedCount, counterSigner.SignedAttributes.Count);
// On NetFx there will be two attributes, because Windows emits the
// content-type attribute even for counter-signers.
int expectedCount = 1;
-#if netfx
+#if NETFRAMEWORK
expectedCount = 2;
#endif
Assert.Equal(expectedCount, counterSigner.SignedAttributes.Count);
Assert.NotEqual(firstSigner2.Certificate, counterSigner.Certificate);
Assert.Equal(2, cms.Certificates.Count);
-#if netcoreapp
+#if NETCOREAPP
byte[] signature = counterSigner.GetSignature();
Assert.NotEmpty(signature);
// DSA PKIX signature format is a DER SEQUENCE.
// On NetFx there will be two attributes, because Windows emits the
// content-type attribute even for counter-signers.
int expectedCount = 1;
-#if netfx
+#if NETFRAMEWORK
expectedCount = 2;
#endif
Assert.Equal(expectedCount, counterSigner.SignedAttributes.Count);
Assert.NotEqual(firstSigner2.Certificate, counterSigner.Certificate);
Assert.Equal(2, cms.Certificates.Count);
-#if netcoreapp
+#if NETCOREAPP
byte[] signature = counterSigner.GetSignature();
Assert.NotEmpty(signature);
// DSA PKIX signature format is a DER SEQUENCE.
cms.SignerInfos[0].ComputeCounterSignature(signer);
bool ExpectCopyRemoved =
-#if netfx
+#if NETFRAMEWORK
false
#else
true
}
}
-#if netcoreapp
+#if NETCOREAPP
[Fact]
public static void ClearCallsDispose()
{
Assert.False(output.CanRead);
}
-#if netcoreapp
+#if NETCOREAPP
using (MemoryStream output = new MemoryStream())
{
using (CryptoStream encryptStream = new CryptoStream(output, encryptor, CryptoStreamMode.Write, leaveOpen: false))
Exception exception = Assert.Throws<CryptographicException>(
() =>
request.Create(request.SubjectName, generator, now, now.AddDays(1), new byte[1]));
-#if netcoreapp
+#if NETCOREAPP
if (CultureInfo.CurrentCulture.Name == "en-US")
{
Assert.Contains("ASN1", exception.Message, StringComparison.OrdinalIgnoreCase);
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-#if netcoreapp || uap
+#if NETCOREAPP || uap
#define HAVE_STORE_ISOPEN
#endif
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityPermissionAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityPermissionFlag))]
-#if netcoreapp || uap || netcoreapp30
+#if NETCOREAPP || uap
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.IStackWalk))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.PermissionSet))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.PermissionState))]
void FromXml(System.Security.SecurityElement e, System.Security.Policy.PolicyLevel level);
System.Security.SecurityElement ToXml(System.Security.Policy.PolicyLevel level);
}
-#if !netcoreapp && !netcoreapp30 && !uap
+#if !NETCOREAPP && !uap
public partial interface IStackWalk
{
void Assert();
public override int GetHashCode() { throw null; }
public override System.Security.SecurityElement ToXml() { throw null; }
}
-#if !netcoreapp && !netcoreapp30 && !uap
+#if !NETCOREAPP && !uap
public partial class PermissionSet : System.Collections.ICollection, System.Collections.IEnumerable, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
{
public PermissionSet(System.Security.Permissions.PermissionState state) { }
public override System.Security.IPermission CreatePermission() { throw null; }
public System.Security.PermissionSet CreatePermissionSet() { throw null; }
}
-#if !netcoreapp && !netcoreapp30 && !uap
+#if !NETCOREAPP && !uap
public enum PermissionState
{
None = 0,
// otherwise you would see this: "S-1-NTAuthority-32-544"
//
-#if netcoreapp20
+#if NETCOREAPP2_0
StringBuilder result = new StringBuilder();
result.Append("S-1-").Append((ulong)_identifierAuthority);
for (int i = 0; i < SubAuthorityCount; i++)
}
}
-#if netcoreapp
+#if NETCOREAPP
[ConditionalTheory(nameof(AccountIsDomainJoined))]
[InlineData(WellKnownSidType.WinBuiltinDCOMUsersSid)]
[InlineData(WellKnownSidType.WinBuiltinIUsersSid)]
<!-- For the inbox library (that is shipping with the product), this should always be true. -->
<!-- BUILDING_INBOX_LIBRARY is only false when building the netstandard compatible NuGet package. -->
<DefineConstants Condition="'$(TargetsNETStandard)' != 'true' AND '$(TargetsNetFx)' != 'true'">$(DefineConstants);BUILDING_INBOX_LIBRARY</DefineConstants>
- <DefineConstants Condition="'$(TargetsNetFx)' == 'true'">$(DefineConstants);netstandard</DefineConstants>
<!-- Workaround for overriding the XML comments related warnings that are being supressed repo wide (within arcade): -->
<!-- https://github.com/dotnet/arcade/blob/ea6addfdc65e5df1b2c036f11614a5f922e36267/src/Microsoft.DotNet.Arcade.Sdk/tools/ProjectDefaults.props#L90 -->
<!-- For this project, we want warnings if there are public APIs/types without properly formatted XML comments (particularly CS1591). -->
internal static string Utf8GetString(ReadOnlySpan<byte> bytes)
{
return Encoding.UTF8.GetString(bytes
-#if netstandard
+#if NETSTANDARD2_0 || NETFRAMEWORK
.ToArray()
#endif
);
/// </summary>
internal static bool TryAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
{
-#if netstandard
+#if NETSTANDARD2_0 || NETFRAMEWORK
if (!dictionary.ContainsKey(key))
{
dictionary[key] = value;
expectedValue,
Encoding.UTF8.GetString(
buffer.WrittenSpan
-#if netfx
+#if NETFRAMEWORK
.ToArray()
#endif
));
{
string value = Encoding.UTF8.GetString(
buffer.WrittenSpan
-#if netfx
+#if NETFRAMEWORK
.ToArray()
#endif
);
{
string value = Encoding.UTF8.GetString(
buffer.WrittenSpan
-#if netfx
+#if NETFRAMEWORK
.ToArray()
#endif
);
string result = Encoding.UTF8.GetString(
output.WrittenSpan
-#if netfx
+#if NETFRAMEWORK
.ToArray()
#endif
);
using System.Collections;
using Xunit;
-#if netcoreapp
+#if NETCOREAPP
using System.Runtime.CompilerServices;
#endif
AssertExtensions.Throws<ArgumentException>("other", () => ((IStructuralComparable)a).CompareTo("string", DummyTestComparer.Instance));
Assert.Equal("(1, 2, 3, 4, 5, 6, 7, )", CreateLong(1, 2, 3, 4, 5, 6, 7, new ValueTuple()).ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create();
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Throws<IndexOutOfRangeException>(() => it[0].ToString());
Assert.Equal("()", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1, 2);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1, 2, 3);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1, 2, 3, 4);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1, 2, 3, 4, 5);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, , , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1, 2, 3, 4, 5, 6);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, , , , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = ValueTuple.Create(1, 2, 3, 4, 5, 6, 7);
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(, , , , , , , )", vtWithNull.ToString());
Assert.Equal(tupleWithNull.ToString(), vtWithNull.ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = CreateLong(1, 2, 3, 4, 5, 6, 7, ValueTuple.Create(8));
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
Assert.Equal("(1, 2, 3, 4, 5, 6, 7, 1, 0, 0, 0, 0, 0, 0, 42)", CreateLong(1, 2, 3, 4, 5, 6, 7, d).ToString());
-#if netcoreapp
+#if NETCOREAPP
ITuple it = d;
Assert.Throws<IndexOutOfRangeException>(() => it[-1].ToString());
Assert.Equal(1, it[0]);
[assembly: TypeForwardedTo(typeof(System.IntPtr))]
[assembly: TypeForwardedTo(typeof(System.MulticastDelegate))]
[assembly: TypeForwardedTo(typeof(System.Object))]
-#if !NETSTANDARD10 && !NETSTANDARD12
+#if !NETSTANDARD1_0 && !NETSTANDARD1_2
[assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsConst))]
#endif
[assembly: TypeForwardedTo(typeof(System.Single))]
against Windows.winmd. The real mscorlib comes from src/shims/shims.proj -->
<BinPlaceRef>false</BinPlaceRef>
<Configurations>netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release;netstandard1.0-Debug;netstandard1.0-Release;uap-Debug;uap-Release</Configurations>
- <DefineConstants Condition="'$(TargetGroup)' == 'netstandard1.2'">$(DefineConstants);NETSTANDARD12</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="TypeForwards.cs" />
// Add any internal types that we need to forward from System.Data.
// These types are required for Desktop to Core serialization as they are not covered by GenAPI because they are not exposed in the ref assembly.
-#if netcoreapp
+#if NETCOREAPP
// System.Data.Odbc is only supported on netcoreapp
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.Odbc.ODBC32))]
#endif
\ No newline at end of file