You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
19
mcs/class/corlib/corefx/AesCcm.cs
Normal file
19
mcs/class/corlib/corefx/AesCcm.cs
Normal file
@ -0,0 +1,19 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
public sealed partial class AesCcm : System.IDisposable
|
||||
{
|
||||
public AesCcm (byte[] key) => throw new PlatformNotSupportedException ();
|
||||
public AesCcm (System.ReadOnlySpan<byte> key) => throw new PlatformNotSupportedException ();
|
||||
public static System.Security.Cryptography.KeySizes NonceByteSizes => throw new PlatformNotSupportedException ();
|
||||
public static System.Security.Cryptography.KeySizes TagByteSizes => throw new PlatformNotSupportedException ();
|
||||
public void Decrypt (byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[] associatedData = null) => throw new PlatformNotSupportedException ();
|
||||
public void Decrypt (System.ReadOnlySpan<byte> nonce, System.ReadOnlySpan<byte> ciphertext, System.ReadOnlySpan<byte> tag, System.Span<byte> plaintext, System.ReadOnlySpan<byte> associatedData = default(System.ReadOnlySpan<byte>)) => throw new PlatformNotSupportedException ();
|
||||
public void Dispose () {}
|
||||
public void Encrypt (byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[] associatedData = null) => throw new PlatformNotSupportedException ();
|
||||
public void Encrypt (System.ReadOnlySpan<byte> nonce, System.ReadOnlySpan<byte> plaintext, System.Span<byte> ciphertext, System.Span<byte> tag, System.ReadOnlySpan<byte> associatedData = default(System.ReadOnlySpan<byte>)) => throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
19
mcs/class/corlib/corefx/AesGcm.cs
Normal file
19
mcs/class/corlib/corefx/AesGcm.cs
Normal file
@ -0,0 +1,19 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
public sealed partial class AesGcm : System.IDisposable
|
||||
{
|
||||
public AesGcm (byte[] key) => throw new PlatformNotSupportedException ();
|
||||
public AesGcm (System.ReadOnlySpan<byte> key) => throw new PlatformNotSupportedException ();
|
||||
public static System.Security.Cryptography.KeySizes NonceByteSizes => throw new PlatformNotSupportedException ();
|
||||
public static System.Security.Cryptography.KeySizes TagByteSizes => throw new PlatformNotSupportedException ();
|
||||
public void Decrypt (byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[] associatedData = null) => throw new PlatformNotSupportedException ();
|
||||
public void Decrypt (System.ReadOnlySpan<byte> nonce, System.ReadOnlySpan<byte> ciphertext, System.ReadOnlySpan<byte> tag, System.Span<byte> plaintext, System.ReadOnlySpan<byte> associatedData = default(System.ReadOnlySpan<byte>)) => throw new PlatformNotSupportedException ();
|
||||
public void Dispose () {}
|
||||
public void Encrypt (byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[] associatedData = null) => throw new PlatformNotSupportedException ();
|
||||
public void Encrypt (System.ReadOnlySpan<byte> nonce, System.ReadOnlySpan<byte> plaintext, System.Span<byte> ciphertext, System.Span<byte> tag, System.ReadOnlySpan<byte> associatedData = default(System.ReadOnlySpan<byte>)) => throw new PlatformNotSupportedException ();
|
||||
}
|
||||
}
|
@ -26,6 +26,9 @@
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
// Disable unreachable code warnings in this entire file.
|
||||
#pragma warning disable 162
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
partial class CompareInfo
|
||||
|
18
mcs/class/corlib/corefx/DiagnosticCounter.cs
Normal file
18
mcs/class/corlib/corefx/DiagnosticCounter.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Diagnostics.Tracing
|
||||
{
|
||||
public abstract partial class DiagnosticCounter : IDisposable
|
||||
{
|
||||
internal DiagnosticCounter (string name, EventSource eventSource) { }
|
||||
internal DiagnosticCounter () { }
|
||||
public string DisplayName { get; set; }
|
||||
public string DisplayUnits { get; set; }
|
||||
public EventSource EventSource { get; }
|
||||
public string Name { get; }
|
||||
public void AddMetadata (string key, string value) { }
|
||||
public void Dispose () { }
|
||||
}
|
||||
}
|
14
mcs/class/corlib/corefx/EnumeratorCancellationAttribute.cs
Normal file
14
mcs/class/corlib/corefx/EnumeratorCancellationAttribute.cs
Normal file
@ -0,0 +1,14 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
[System.AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||
public sealed class EnumeratorCancellationAttribute : Attribute
|
||||
{
|
||||
public EnumeratorCancellationAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
13
mcs/class/corlib/corefx/IncrementingEventCounter.cs
Normal file
13
mcs/class/corlib/corefx/IncrementingEventCounter.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Diagnostics.Tracing
|
||||
{
|
||||
public partial class IncrementingEventCounter : DiagnosticCounter
|
||||
{
|
||||
public IncrementingEventCounter (string name, EventSource eventSource) : base (name, eventSource) {}
|
||||
public void Increment (double increment = 1) {}
|
||||
public TimeSpan DisplayRateTimeScale { get; set; }
|
||||
}
|
||||
}
|
12
mcs/class/corlib/corefx/IncrementingPollingCounter.cs
Normal file
12
mcs/class/corlib/corefx/IncrementingPollingCounter.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Diagnostics.Tracing
|
||||
{
|
||||
public partial class IncrementingPollingCounter : DiagnosticCounter
|
||||
{
|
||||
public IncrementingPollingCounter (string name, EventSource eventSource, Func<double> totalValueProvider) : base (name, eventSource) {}
|
||||
public TimeSpan DisplayRateTimeScale { get; set; }
|
||||
}
|
||||
}
|
15
mcs/class/corlib/corefx/PbeEncryptionAlgorithm.cs
Normal file
15
mcs/class/corlib/corefx/PbeEncryptionAlgorithm.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
public enum PbeEncryptionAlgorithm
|
||||
{
|
||||
Unknown = 0,
|
||||
Aes128Cbc = 1,
|
||||
Aes192Cbc = 2,
|
||||
Aes256Cbc = 3,
|
||||
TripleDes3KeyPkcs12 = 4,
|
||||
}
|
||||
}
|
31
mcs/class/corlib/corefx/PbeParameters.cs
Normal file
31
mcs/class/corlib/corefx/PbeParameters.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
public sealed class PbeParameters
|
||||
{
|
||||
public PbeEncryptionAlgorithm EncryptionAlgorithm { get; }
|
||||
public HashAlgorithmName HashAlgorithm { get; }
|
||||
public int IterationCount { get; }
|
||||
|
||||
public PbeParameters(
|
||||
PbeEncryptionAlgorithm encryptionAlgorithm,
|
||||
HashAlgorithmName hashAlgorithm,
|
||||
int iterationCount)
|
||||
{
|
||||
if (iterationCount < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
nameof(iterationCount),
|
||||
iterationCount,
|
||||
SR.ArgumentOutOfRange_NeedPosNum);
|
||||
}
|
||||
|
||||
EncryptionAlgorithm = encryptionAlgorithm;
|
||||
HashAlgorithm = hashAlgorithm;
|
||||
IterationCount = iterationCount;
|
||||
}
|
||||
}
|
||||
}
|
11
mcs/class/corlib/corefx/PollingCounter.cs
Normal file
11
mcs/class/corlib/corefx/PollingCounter.cs
Normal file
@ -0,0 +1,11 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.Diagnostics.Tracing
|
||||
{
|
||||
public partial class PollingCounter : DiagnosticCounter
|
||||
{
|
||||
public PollingCounter (string name, EventSource eventSource, Func<double> metricProvider) : base (name, eventSource) {}
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
using System.Buffers;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
partial class RandomNumberGenerator
|
||||
@ -13,5 +16,84 @@ namespace System.Security.Cryptography
|
||||
fixed (byte* ptr = data) Interop.GetRandomBytes (ptr, data.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void GetBytes(Span<byte> data)
|
||||
{
|
||||
byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
|
||||
try
|
||||
{
|
||||
GetBytes(array, 0, data.Length);
|
||||
new ReadOnlySpan<byte>(array, 0, data.Length).CopyTo(data);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Array.Clear(array, 0, data.Length);
|
||||
ArrayPool<byte>.Shared.Return(array);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void GetNonZeroBytes(Span<byte> data)
|
||||
{
|
||||
byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
|
||||
try
|
||||
{
|
||||
// NOTE: There is no GetNonZeroBytes(byte[], int, int) overload, so this call
|
||||
// may end up retrieving more data than was intended, if the array pool
|
||||
// gives back a larger array than was actually needed.
|
||||
GetNonZeroBytes(array);
|
||||
new ReadOnlySpan<byte>(array, 0, data.Length).CopyTo(data);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Array.Clear(array, 0, data.Length);
|
||||
ArrayPool<byte>.Shared.Return(array);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetInt32(int fromInclusive, int toExclusive)
|
||||
{
|
||||
if (fromInclusive >= toExclusive)
|
||||
throw new ArgumentException(SR.Argument_InvalidRandomRange);
|
||||
|
||||
// The total possible range is [0, 4,294,967,295).
|
||||
// Subtract one to account for zero being an actual possibility.
|
||||
uint range = (uint)toExclusive - (uint)fromInclusive - 1;
|
||||
|
||||
// If there is only one possible choice, nothing random will actually happen, so return
|
||||
// the only possibility.
|
||||
if (range == 0)
|
||||
{
|
||||
return fromInclusive;
|
||||
}
|
||||
|
||||
// Create a mask for the bits that we care about for the range. The other bits will be
|
||||
// masked away.
|
||||
uint mask = range;
|
||||
mask |= mask >> 1;
|
||||
mask |= mask >> 2;
|
||||
mask |= mask >> 4;
|
||||
mask |= mask >> 8;
|
||||
mask |= mask >> 16;
|
||||
|
||||
Span<uint> resultSpan = stackalloc uint[1];
|
||||
uint result;
|
||||
|
||||
do
|
||||
{
|
||||
FillSpan(MemoryMarshal.AsBytes(resultSpan));
|
||||
result = mask & resultSpan[0];
|
||||
}
|
||||
while (result > range);
|
||||
|
||||
return (int)result + fromInclusive;
|
||||
}
|
||||
|
||||
public static int GetInt32(int toExclusive)
|
||||
{
|
||||
if (toExclusive <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(toExclusive), SR.ArgumentOutOfRange_NeedPosNum);
|
||||
|
||||
return GetInt32(0, toExclusive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
mcs/class/corlib/corefx/RuntimeFeature.cs
Normal file
9
mcs/class/corlib/corefx/RuntimeFeature.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
partial class RuntimeFeature
|
||||
{
|
||||
// https://github.com/dotnet/coreclr/blob/397aaccb5104844998c3bcf6e9245cc81127e1e2/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.CoreCLR.cs#L9-L10
|
||||
public static bool IsDynamicCodeSupported => true;
|
||||
public static bool IsDynamicCodeCompiled => true;
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
c924ca12f5eed8122fd0b8ca78a6b339fae2c971
|
||||
0d8ca7ea2340d4d83a6e2e36ccfef2a1088c23f7
|
@ -23,4 +23,7 @@ partial class SR
|
||||
public const string Argument_MemberAndArray = "Cannot supply both a MemberInfo and an Array to indicate the parent of a value type.";
|
||||
public const string Argument_MustSupplyContainer = "When supplying a FieldInfo for fixing up a nested type, a valid ID for that containing object must also be supplied.";
|
||||
public const string Serialization_NoID = "Object has never been assigned an objectID";
|
||||
public const string Arg_SwitchExpressionException = "Non-exhaustive switch expression failed to match its input.";
|
||||
public const string SwitchExpressionException_UnmatchedValue = "Unmatched value was {0}.";
|
||||
public const string Argument_InvalidRandomRange = "Range of random number does not contain at least one possibility.";
|
||||
}
|
20
mcs/class/corlib/corefx/Stream.cs
Normal file
20
mcs/class/corlib/corefx/Stream.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
partial class Stream : IAsyncDisposable
|
||||
{
|
||||
public virtual ValueTask DisposeAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispose();
|
||||
return default;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
return new ValueTask(Task.FromException(exc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
66
mcs/class/corlib/corefx/SwitchExpressionException.cs
Normal file
66
mcs/class/corlib/corefx/SwitchExpressionException.cs
Normal file
@ -0,0 +1,66 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
// MONO: this file was copied from CoreFX master for NS2.1
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a switch expression that was non-exhaustive failed to match its input
|
||||
/// at runtime, e.g. in the C# 8 expression <code>3 switch { 4 => 5 }</code>.
|
||||
/// The exception optionally contains an object representing the unmatched value.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public sealed class SwitchExpressionException : InvalidOperationException
|
||||
{
|
||||
public SwitchExpressionException()
|
||||
: base(SR.Arg_SwitchExpressionException) { }
|
||||
|
||||
public SwitchExpressionException(Exception innerException) :
|
||||
base(SR.Arg_SwitchExpressionException, innerException) { }
|
||||
|
||||
public SwitchExpressionException(object unmatchedValue) : this()
|
||||
{
|
||||
UnmatchedValue = unmatchedValue;
|
||||
}
|
||||
|
||||
private SwitchExpressionException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
UnmatchedValue = info.GetValue(nameof(UnmatchedValue), typeof(object));
|
||||
}
|
||||
|
||||
public SwitchExpressionException(string message) : base(message) { }
|
||||
|
||||
public SwitchExpressionException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
public object UnmatchedValue { get; }
|
||||
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue(nameof(UnmatchedValue), UnmatchedValue, typeof(object));
|
||||
}
|
||||
|
||||
public override string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
#if __MonoCS__
|
||||
if (UnmatchedValue == null)
|
||||
#else
|
||||
if (UnmatchedValue is null)
|
||||
#endif
|
||||
{
|
||||
return base.Message;
|
||||
}
|
||||
string valueMessage = SR.Format(SR.SwitchExpressionException_UnmatchedValue, UnmatchedValue.ToString());
|
||||
return base.Message + Environment.NewLine + valueMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
mcs/class/corlib/corefx/TaskAsyncEnumerableExtensions.cs
Normal file
38
mcs/class/corlib/corefx/TaskAsyncEnumerableExtensions.cs
Normal file
@ -0,0 +1,38 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Threading.Tasks
|
||||
{
|
||||
/// <summary>Provides a set of static methods for configuring <see cref="Task"/>-related behaviors on asynchronous enumerables and disposables.</summary>
|
||||
public static class TaskAsyncEnumerableExtensions
|
||||
{
|
||||
/// <summary>Configures how awaits on the tasks returned from an async disposable will be performed.</summary>
|
||||
/// <param name="source">The source async disposable.</param>
|
||||
/// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
|
||||
/// <returns>The configured async disposable.</returns>
|
||||
public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext) =>
|
||||
new ConfiguredAsyncDisposable(source, continueOnCapturedContext);
|
||||
|
||||
/// <summary>Configures how awaits on the tasks returned from an async iteration will be performed.</summary>
|
||||
/// <typeparam name="T">The type of the objects being iterated.</typeparam>
|
||||
/// <param name="source">The source enumerable being iterated.</param>
|
||||
/// <param name="continueOnCapturedContext">Whether to capture and marshal back to the current context.</param>
|
||||
/// <returns>The configured enumerable.</returns>
|
||||
public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(
|
||||
this IAsyncEnumerable<T> source, bool continueOnCapturedContext) =>
|
||||
new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext, cancellationToken: default);
|
||||
|
||||
/// <summary>Sets the <see cref="CancellationToken"/> to be passed to <see cref="IAsyncEnumerable{T}.GetAsyncEnumerator(CancellationToken)"/> when iterating.</summary>
|
||||
/// <typeparam name="T">The type of the objects being iterated.</typeparam>
|
||||
/// <param name="source">The source enumerable being iterated.</param>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param>
|
||||
/// <returns>The configured enumerable.</returns>
|
||||
public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(
|
||||
this IAsyncEnumerable<T> source, CancellationToken cancellationToken) =>
|
||||
new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext: true, cancellationToken);
|
||||
}
|
||||
}
|
11
mcs/class/corlib/corefx/TextWriter.cs
Normal file
11
mcs/class/corlib/corefx/TextWriter.cs
Normal file
@ -0,0 +1,11 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Adds IAsyncDisposable to TextWriter
|
||||
partial class TextWriter : IAsyncDisposable
|
||||
{
|
||||
}
|
||||
}
|
11
mcs/class/corlib/corefx/ThrowHelper.cs
Normal file
11
mcs/class/corlib/corefx/ThrowHelper.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace System
|
||||
{
|
||||
partial class ThrowHelper
|
||||
{
|
||||
internal static void ThrowValueArgumentOutOfRange_NeedNonNegNumException()
|
||||
{
|
||||
throw GetArgumentOutOfRangeException(ExceptionArgument.value,
|
||||
ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user