Adding support for .NET 8.0 LTS, renaming private fields to start with underscore
This commit is contained in:
@@ -12,10 +12,10 @@ namespace System.Collections.Generic
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly Queue<T> queue;
|
||||
private readonly Queue<T> _queue;
|
||||
|
||||
private TaskCompletionSource<bool> dequeueTcs = new();
|
||||
private TaskCompletionSource<bool> availableTcs = new();
|
||||
private TaskCompletionSource<bool> _dequeueTcs = new();
|
||||
private TaskCompletionSource<bool> _availableTcs = new();
|
||||
|
||||
#endregion Fields
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public AsyncQueue()
|
||||
{
|
||||
queue = new Queue<T>();
|
||||
_queue = new Queue<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -40,7 +40,7 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public AsyncQueue(IEnumerable<T> collection)
|
||||
{
|
||||
queue = new Queue<T>();
|
||||
_queue = new Queue<T>();
|
||||
Enqueue(collection);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public AsyncQueue(int capacity)
|
||||
{
|
||||
queue = new Queue<T>(capacity);
|
||||
_queue = new Queue<T>(capacity);
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
@@ -67,9 +67,9 @@ namespace System.Collections.Generic
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
return queue.Count;
|
||||
return _queue.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,9 +84,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public void Clear()
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
queue.Clear();
|
||||
_queue.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public bool Contains(T item)
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
return queue.Contains(item);
|
||||
return _queue.Contains(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +115,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
queue.CopyTo(array, arrayIndex);
|
||||
_queue.CopyTo(array, arrayIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public T Dequeue()
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
return queue.Dequeue();
|
||||
return _queue.Dequeue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,11 +141,11 @@ namespace System.Collections.Generic
|
||||
/// <param name="item">The object to add to the <see cref="AsyncQueue{T}"/>. The value can be null for reference types.</param>
|
||||
public void Enqueue(T item)
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
queue.Enqueue(item);
|
||||
SetToken(dequeueTcs);
|
||||
SetToken(availableTcs);
|
||||
_queue.Enqueue(item);
|
||||
SetToken(_dequeueTcs);
|
||||
SetToken(_availableTcs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,9 +157,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public T Peek()
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
return queue.Peek();
|
||||
return _queue.Peek();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,9 +170,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public T[] ToArray()
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
return queue.ToArray();
|
||||
return _queue.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,9 +182,9 @@ namespace System.Collections.Generic
|
||||
[ExcludeFromCodeCoverage]
|
||||
public void TrimExcess()
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
queue.TrimExcess();
|
||||
_queue.TrimExcess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,21 +203,21 @@ namespace System.Collections.Generic
|
||||
while (true)
|
||||
{
|
||||
TaskCompletionSource<bool> internalDequeueTcs;
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
if (queue.Count > 0)
|
||||
if (_queue.Count > 0)
|
||||
{
|
||||
int count = queue.Count;
|
||||
int count = _queue.Count;
|
||||
if (maxCount > 0 && count > maxCount)
|
||||
count = maxCount;
|
||||
|
||||
var items = new T[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
items[i] = queue.Dequeue();
|
||||
items[i] = _queue.Dequeue();
|
||||
|
||||
return items;
|
||||
}
|
||||
internalDequeueTcs = ResetToken(ref dequeueTcs);
|
||||
internalDequeueTcs = ResetToken(ref _dequeueTcs);
|
||||
}
|
||||
|
||||
await WaitAsync(internalDequeueTcs, cancellationToken).ConfigureAwait(false);
|
||||
@@ -238,17 +238,17 @@ namespace System.Collections.Generic
|
||||
while (true)
|
||||
{
|
||||
TaskCompletionSource<bool> internalDequeueTcs;
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
if (count <= queue.Count)
|
||||
if (count <= _queue.Count)
|
||||
{
|
||||
var items = new T[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
items[i] = queue.Dequeue();
|
||||
items[i] = _queue.Dequeue();
|
||||
|
||||
return items;
|
||||
}
|
||||
internalDequeueTcs = ResetToken(ref dequeueTcs);
|
||||
internalDequeueTcs = ResetToken(ref _dequeueTcs);
|
||||
}
|
||||
|
||||
await WaitAsync(internalDequeueTcs, cancellationToken).ConfigureAwait(false);
|
||||
@@ -265,12 +265,12 @@ namespace System.Collections.Generic
|
||||
while (true)
|
||||
{
|
||||
TaskCompletionSource<bool> internalDequeueTcs;
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
if (queue.Count > 0)
|
||||
return queue.Dequeue();
|
||||
if (_queue.Count > 0)
|
||||
return _queue.Dequeue();
|
||||
|
||||
internalDequeueTcs = ResetToken(ref dequeueTcs);
|
||||
internalDequeueTcs = ResetToken(ref _dequeueTcs);
|
||||
}
|
||||
|
||||
await WaitAsync(internalDequeueTcs, cancellationToken).ConfigureAwait(false);
|
||||
@@ -285,12 +285,12 @@ namespace System.Collections.Generic
|
||||
public async Task WaitAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
TaskCompletionSource<bool> internalAvailableTcs;
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
if (queue.Count > 0)
|
||||
if (_queue.Count > 0)
|
||||
return;
|
||||
|
||||
internalAvailableTcs = ResetToken(ref availableTcs);
|
||||
internalAvailableTcs = ResetToken(ref _availableTcs);
|
||||
}
|
||||
|
||||
await WaitAsync(internalAvailableTcs, cancellationToken).ConfigureAwait(false);
|
||||
@@ -347,10 +347,10 @@ namespace System.Collections.Generic
|
||||
/// <returns>true if item is successfully removed; otherwise, false. This method also returns false if item was not found in the <see cref="AsyncQueue{T}"/>.</returns>
|
||||
public bool Remove(T item)
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
var copy = new Queue<T>(queue);
|
||||
queue.Clear();
|
||||
var copy = new Queue<T>(_queue);
|
||||
_queue.Clear();
|
||||
|
||||
bool found = false;
|
||||
int count = copy.Count;
|
||||
@@ -359,7 +359,7 @@ namespace System.Collections.Generic
|
||||
var element = copy.Dequeue();
|
||||
if (found)
|
||||
{
|
||||
queue.Enqueue(element);
|
||||
_queue.Enqueue(element);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace System.Collections.Generic
|
||||
continue;
|
||||
}
|
||||
|
||||
queue.Enqueue(element);
|
||||
_queue.Enqueue(element);
|
||||
}
|
||||
|
||||
return found;
|
||||
@@ -382,19 +382,19 @@ namespace System.Collections.Generic
|
||||
/// <param name="collection">The objects to add to the <see cref="AsyncQueue{T}"/>.</param>
|
||||
public void Enqueue(IEnumerable<T> collection)
|
||||
{
|
||||
lock (queue)
|
||||
lock (_queue)
|
||||
{
|
||||
bool hasElements = false;
|
||||
foreach (var element in collection)
|
||||
{
|
||||
hasElements = true;
|
||||
queue.Enqueue(element);
|
||||
_queue.Enqueue(element);
|
||||
}
|
||||
|
||||
if (hasElements)
|
||||
{
|
||||
SetToken(dequeueTcs);
|
||||
SetToken(availableTcs);
|
||||
SetToken(_dequeueTcs);
|
||||
SetToken(_availableTcs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,12 @@ namespace System.Security.Cryptography
|
||||
/// </summary>
|
||||
public class CryptographyHelper
|
||||
{
|
||||
private static int saltLength = 8;
|
||||
// "readonly" not added due to UnitTests
|
||||
#pragma warning disable IDE0044 // Add "readonly" modifier
|
||||
private static int _saltLength = 8;
|
||||
#pragma warning restore IDE0044 // Add "readonly" modifier
|
||||
|
||||
private readonly string masterKeyFile;
|
||||
private readonly string _masterKeyFile;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CryptographyHelper"/> class.
|
||||
@@ -18,17 +21,17 @@ namespace System.Security.Cryptography
|
||||
/// <param name="keyFile">The (absolute) path to the crypto key file. On <c>null</c> the file 'crypto.key' at the executing assembly location will be used.</param>
|
||||
public CryptographyHelper(string keyFile = null)
|
||||
{
|
||||
masterKeyFile = keyFile;
|
||||
_masterKeyFile = keyFile;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(masterKeyFile))
|
||||
masterKeyFile = "crypto.key";
|
||||
if (string.IsNullOrWhiteSpace(_masterKeyFile))
|
||||
_masterKeyFile = "crypto.key";
|
||||
|
||||
if (!Path.IsPathRooted(masterKeyFile))
|
||||
masterKeyFile = Path.Combine(AppContext.BaseDirectory, masterKeyFile);
|
||||
if (!Path.IsPathRooted(_masterKeyFile))
|
||||
_masterKeyFile = Path.Combine(AppContext.BaseDirectory, _masterKeyFile);
|
||||
|
||||
string pw = File.Exists(masterKeyFile) ? File.ReadAllText(masterKeyFile) : null;
|
||||
string pw = File.Exists(_masterKeyFile) ? File.ReadAllText(_masterKeyFile) : null;
|
||||
if (string.IsNullOrWhiteSpace(pw))
|
||||
File.WriteAllText(masterKeyFile, GetRandomString(64));
|
||||
File.WriteAllText(_masterKeyFile, GetRandomString(64));
|
||||
}
|
||||
|
||||
#region Instance methods
|
||||
@@ -46,8 +49,7 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The decrypted data.</returns>
|
||||
public byte[] DecryptAes(byte[] cipher, string password = null)
|
||||
{
|
||||
if (password == null)
|
||||
password = File.ReadAllText(masterKeyFile);
|
||||
password ??= File.ReadAllText(_masterKeyFile);
|
||||
|
||||
return AesDecrypt(cipher, password);
|
||||
}
|
||||
@@ -63,8 +65,7 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The encrypted data (cipher).</returns>
|
||||
public byte[] EncryptAes(byte[] plain, string password = null)
|
||||
{
|
||||
if (password == null)
|
||||
password = File.ReadAllText(masterKeyFile);
|
||||
password ??= File.ReadAllText(_masterKeyFile);
|
||||
|
||||
return AesEncrypt(plain, password);
|
||||
}
|
||||
@@ -110,8 +111,7 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The decrypted data.</returns>
|
||||
public byte[] DecryptTripleDes(byte[] cipher, string password = null)
|
||||
{
|
||||
if (password == null)
|
||||
password = File.ReadAllText(masterKeyFile);
|
||||
password ??= File.ReadAllText(_masterKeyFile);
|
||||
|
||||
return TripleDesDecrypt(cipher, password);
|
||||
}
|
||||
@@ -127,8 +127,7 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The encrypted data (cipher).</returns>
|
||||
public byte[] EncryptTripleDes(byte[] plain, string password = null)
|
||||
{
|
||||
if (password == null)
|
||||
password = File.ReadAllText(masterKeyFile);
|
||||
password ??= File.ReadAllText(_masterKeyFile);
|
||||
|
||||
return TripleDesEncrypt(plain, password);
|
||||
}
|
||||
@@ -183,8 +182,8 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The decrypted data.</returns>
|
||||
public static byte[] AesDecrypt(byte[] cipher, string password)
|
||||
{
|
||||
byte[] salt = new byte[saltLength];
|
||||
Array.Copy(cipher, salt, saltLength);
|
||||
byte[] salt = new byte[_saltLength];
|
||||
Array.Copy(cipher, salt, _saltLength);
|
||||
|
||||
using var gen = new Rfc2898DeriveBytes(password, salt);
|
||||
using var aes = Aes.Create();
|
||||
@@ -197,7 +196,7 @@ namespace System.Security.Cryptography
|
||||
using var ms = new MemoryStream();
|
||||
using var cs = new CryptoStream(ms, aes.CreateDecryptor(), CryptoStreamMode.Write);
|
||||
|
||||
cs.Write(cipher, saltLength, cipher.Length - saltLength);
|
||||
cs.Write(cipher, _saltLength, cipher.Length - _saltLength);
|
||||
cs.FlushFinalBlock();
|
||||
|
||||
return ms.ToArray();
|
||||
@@ -224,7 +223,7 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The encrypted data (cipher).</returns>
|
||||
public static byte[] AesEncrypt(byte[] plain, string password)
|
||||
{
|
||||
byte[] salt = GetRandomBytes(saltLength);
|
||||
byte[] salt = GetRandomBytes(_saltLength);
|
||||
|
||||
using var gen = new Rfc2898DeriveBytes(password, salt);
|
||||
using var aes = Aes.Create();
|
||||
@@ -269,8 +268,8 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The decrypted data.</returns>
|
||||
public static byte[] TripleDesDecrypt(byte[] cipher, string password)
|
||||
{
|
||||
byte[] salt = new byte[saltLength];
|
||||
Array.Copy(cipher, salt, saltLength);
|
||||
byte[] salt = new byte[_saltLength];
|
||||
Array.Copy(cipher, salt, _saltLength);
|
||||
|
||||
using var gen = new Rfc2898DeriveBytes(password, salt);
|
||||
using var tdes = TripleDES.Create();
|
||||
@@ -283,7 +282,7 @@ namespace System.Security.Cryptography
|
||||
using var ms = new MemoryStream();
|
||||
using var cs = new CryptoStream(ms, tdes.CreateDecryptor(), CryptoStreamMode.Write);
|
||||
|
||||
cs.Write(cipher, saltLength, cipher.Length - saltLength);
|
||||
cs.Write(cipher, _saltLength, cipher.Length - _saltLength);
|
||||
cs.FlushFinalBlock();
|
||||
|
||||
return ms.ToArray();
|
||||
@@ -297,7 +296,7 @@ namespace System.Security.Cryptography
|
||||
/// <returns>The encrypted data (cipher).</returns>
|
||||
public static byte[] TripleDesEncrypt(byte[] plain, string password)
|
||||
{
|
||||
byte[] salt = GetRandomBytes(saltLength);
|
||||
byte[] salt = GetRandomBytes(_saltLength);
|
||||
|
||||
using var gen = new Rfc2898DeriveBytes(password, salt);
|
||||
using var tdes = TripleDES.Create();
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace AMWD.Common.Utilities
|
||||
{
|
||||
#region Data
|
||||
|
||||
private Timer timer;
|
||||
private Timer _timer;
|
||||
|
||||
private bool nextRunPending;
|
||||
private bool _nextRunPending;
|
||||
|
||||
/// <summary>
|
||||
/// The synchronisation object.
|
||||
@@ -130,13 +130,13 @@ namespace AMWD.Common.Utilities
|
||||
tcs = CreateTcs();
|
||||
}
|
||||
IsWaitingToRun = true;
|
||||
if (timer != null)
|
||||
if (_timer != null)
|
||||
{
|
||||
timer.Change(Delay, Timeout.InfiniteTimeSpan);
|
||||
_timer.Change(Delay, Timeout.InfiniteTimeSpan);
|
||||
}
|
||||
else
|
||||
{
|
||||
timer = new Timer(OnTimerCallback, null, Delay, Timeout.InfiniteTimeSpan);
|
||||
_timer = new Timer(OnTimerCallback, null, Delay, Timeout.InfiniteTimeSpan);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,9 +152,9 @@ namespace AMWD.Common.Utilities
|
||||
lock (syncLock)
|
||||
{
|
||||
IsWaitingToRun = false;
|
||||
nextRunPending = false;
|
||||
timer?.Dispose();
|
||||
timer = null;
|
||||
_nextRunPending = false;
|
||||
_timer?.Dispose();
|
||||
_timer = null;
|
||||
if (!IsRunning)
|
||||
{
|
||||
localTcs = tcs;
|
||||
@@ -179,13 +179,13 @@ namespace AMWD.Common.Utilities
|
||||
return false;
|
||||
}
|
||||
IsWaitingToRun = true;
|
||||
if (timer != null)
|
||||
if (_timer != null)
|
||||
{
|
||||
timer.Change(TimeSpan.Zero, Timeout.InfiniteTimeSpan);
|
||||
_timer.Change(TimeSpan.Zero, Timeout.InfiniteTimeSpan);
|
||||
}
|
||||
else
|
||||
{
|
||||
timer = new Timer(OnTimerCallback, null, TimeSpan.Zero, Timeout.InfiniteTimeSpan);
|
||||
_timer = new Timer(OnTimerCallback, null, TimeSpan.Zero, Timeout.InfiniteTimeSpan);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ namespace AMWD.Common.Utilities
|
||||
{
|
||||
tcs = CreateTcs();
|
||||
IsWaitingToRun = true;
|
||||
timer = new Timer(OnTimerCallback, null, Delay, Timeout.InfiniteTimeSpan);
|
||||
_timer = new Timer(OnTimerCallback, null, Delay, Timeout.InfiniteTimeSpan);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace AMWD.Common.Utilities
|
||||
if (IsRunning)
|
||||
{
|
||||
// Currently running, remember and do nothing for now
|
||||
nextRunPending = true;
|
||||
_nextRunPending = true;
|
||||
return;
|
||||
}
|
||||
IsRunning = true;
|
||||
@@ -308,12 +308,12 @@ namespace AMWD.Common.Utilities
|
||||
{
|
||||
runAgain = false;
|
||||
IsRunning = false;
|
||||
nextRunPending = false;
|
||||
_nextRunPending = false;
|
||||
localTcs = tcs;
|
||||
if (!IsWaitingToRun)
|
||||
{
|
||||
timer?.Dispose();
|
||||
timer = null;
|
||||
_timer?.Dispose();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
exceptionHandler?.Invoke(ex);
|
||||
@@ -322,16 +322,16 @@ namespace AMWD.Common.Utilities
|
||||
{
|
||||
lock (syncLock)
|
||||
{
|
||||
runAgain = nextRunPending;
|
||||
runAgain = _nextRunPending;
|
||||
IsRunning = runAgain;
|
||||
nextRunPending = false;
|
||||
_nextRunPending = false;
|
||||
if (!runAgain)
|
||||
{
|
||||
if (!IsWaitingToRun)
|
||||
{
|
||||
localTcs = tcs;
|
||||
timer?.Dispose();
|
||||
timer = null;
|
||||
_timer?.Dispose();
|
||||
_timer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,19 +403,19 @@ namespace AMWD.Common.Utilities
|
||||
/// <typeparam name="TResult">The type of the result value.</typeparam>
|
||||
protected class TaskCompletionSourceWrapper<TResult> : TaskCompletionSourceWrapper
|
||||
{
|
||||
private readonly TaskCompletionSource<TResult> tcs;
|
||||
private readonly TaskCompletionSource<TResult> _tcs;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="Task{TResult}"/> of the <see cref="TaskCompletionSource{TResult}"/>.
|
||||
/// </summary>
|
||||
public override Task Task => tcs.Task;
|
||||
public override Task Task => _tcs.Task;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TaskCompletionSourceWrapper{TResult}"/> class.
|
||||
/// </summary>
|
||||
public TaskCompletionSourceWrapper()
|
||||
{
|
||||
tcs = new TaskCompletionSource<TResult>();
|
||||
_tcs = new TaskCompletionSource<TResult>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -424,13 +424,13 @@ namespace AMWD.Common.Utilities
|
||||
/// </summary>
|
||||
/// <param name="result">The result value to bind to this <see cref="Task{TResult}"/>.</param>
|
||||
/// <seealso cref="TaskCompletionSource{TResult}.TrySetResult(TResult)"/>
|
||||
public void TrySetResult(TResult result) => tcs.TrySetResult(result);
|
||||
public void TrySetResult(TResult result) => _tcs.TrySetResult(result);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void TrySetException(Exception exception) => tcs.TrySetException(exception);
|
||||
public override void TrySetException(Exception exception) => _tcs.TrySetException(exception);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void TrySetCanceled() => tcs.TrySetCanceled();
|
||||
public override void TrySetCanceled() => _tcs.TrySetCanceled();
|
||||
}
|
||||
|
||||
#endregion Internal TaskCompletionSourceWrapper classes
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace AMWD.Common.Utilities
|
||||
if (addressFamily != AddressFamily.Unspecified && ipAddress.AddressFamily != addressFamily)
|
||||
return null;
|
||||
|
||||
return ipAddress;
|
||||
return ipAddress.IsIPv4MappedToIPv6 ? ipAddress.MapToIPv4() : ipAddress;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user