1
0
mirror of https://github.com/chylex/.NET-Community-Toolkit.git synced 2025-05-29 20:34:08 +02:00

More code style improvements and tweaks

- Remove unused namespaces
- Remove unused attributes
- Remove unnecessary #nullable enable directives
- Sort using directives
- Simplify names
This commit is contained in:
Sergio Pedri 2021-11-01 22:29:46 +01:00
parent 9f4c9fad7f
commit 51c7a67c20
63 changed files with 99 additions and 201 deletions
CommunityToolkit.Common
CommunityToolkit.Diagnostics/Internals
CommunityToolkit.HighPerformance
CommunityToolkit.Mvvm.SourceGenerators/ComponentModel
CommunityToolkit.Mvvm
tests

View File

@ -41,7 +41,7 @@ public EventDeferral GetDeferral()
/// </summary>
/// <returns>Internal EventDeferral reference</returns>
#if !NETSTANDARD1_4
[Browsable(false)]
[Browsable(false)]
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This is an internal only method to be used by EventHandler extension classes, public callers should call GetDeferral() instead.")]

View File

@ -34,7 +34,7 @@ internal EventDeferral()
/// <param name="cancellationToken"><see cref="CancellationToken"/>.</param>
/// <returns><see cref="Task"/>.</returns>
#if !NETSTANDARD1_4
[Browsable(false)]
[Browsable(false)]
#endif
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This is an internal only method to be used by EventHandler extension classes, public callers should call GetDeferral() instead on the DeferredEventArgs.")]

View File

@ -47,7 +47,7 @@ public static class ISettingsStorageHelperExtensions
public static TValue? Read<TKey, TValue>(this ISettingsStorageHelper<TKey> storageHelper, TKey key)
where TKey : notnull
{
if (storageHelper.TryRead<TValue>(key, out TValue? value))
if (storageHelper.TryRead(key, out TValue? value))
{
return value;
}

View File

@ -18,7 +18,7 @@ public static partial class Guard
private static partial class ThrowHelper
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotEmpty{T}(Span{T},string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotEmpty{T}(Span{T},string)"/> fails.
/// </summary>
/// <typeparam name="T">The item of items in the input <see cref="Span{T}"/> instance.</typeparam>
/// <remarks>This method is needed because <see cref="Span{T}"/> can't be used as a generic type parameter.</remarks>
@ -29,7 +29,7 @@ public static void ThrowArgumentExceptionForIsNotEmptyWithSpan<T>(string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotEmpty{T}(ReadOnlySpan{T},string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotEmpty{T}(ReadOnlySpan{T},string)"/> fails.
/// </summary>
/// <typeparam name="T">The item of items in the input <see cref="ReadOnlySpan{T}"/> instance.</typeparam>
/// <remarks>This method is needed because <see cref="ReadOnlySpan{T}"/> can't be used as a generic type parameter.</remarks>
@ -40,7 +40,7 @@ public static void ThrowArgumentExceptionForIsNotEmptyWithReadOnlySpan<T>(string
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotEmpty{T}(T[],string)"/> (or an overload) fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotEmpty{T}(T[],string)"/> (or an overload) fails.
/// </summary>
/// <typeparam name="T">The item of items in the input collection.</typeparam>
[DoesNotReturn]

View File

@ -18,7 +18,7 @@ public static partial class Guard
private static partial class ThrowHelper
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsDefault{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsDefault{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of <see langword="struct"/> value type being tested.</typeparam>
[DoesNotReturn]
@ -29,7 +29,7 @@ public static void ThrowArgumentExceptionForIsDefault<T>(T value, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotDefault{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotDefault{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of <see langword="struct"/> value type being tested.</typeparam>
[DoesNotReturn]
@ -40,7 +40,7 @@ public static void ThrowArgumentExceptionForIsNotDefault<T>(string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -50,7 +50,7 @@ public static void ThrowArgumentExceptionForIsEqualTo<T>(T value, T target, stri
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -60,7 +60,7 @@ public static void ThrowArgumentExceptionForIsNotEqualTo<T>(T value, T target, s
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsBitwiseEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsBitwiseEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of input values being compared.</typeparam>
[DoesNotReturn]
@ -71,7 +71,7 @@ public static void ThrowArgumentExceptionForBitwiseEqualTo<T>(T value, T target,
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsLessThan{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsLessThan{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -81,7 +81,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsLessThan<T>(T value, T m
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsLessThanOrEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsLessThanOrEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -91,7 +91,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsLessThanOrEqualTo<T>(T v
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsGreaterThan{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsGreaterThan{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -101,7 +101,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsGreaterThan<T>(T value,
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsGreaterThanOrEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsGreaterThanOrEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -111,7 +111,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsGreaterThanOrEqualTo<T>(
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsInRange{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsInRange{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -121,7 +121,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsInRange<T>(T value, T mi
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsInRange{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsInRange{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -131,7 +131,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsNotInRange<T>(T value, T
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsBetween{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsBetween{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -141,7 +141,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsBetween<T>(T value, T mi
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsNotBetween{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsNotBetween{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -151,7 +151,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsNotBetween<T>(T value, T
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsBetweenOrEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsBetweenOrEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]
@ -161,7 +161,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsBetweenOrEqualTo<T>(T va
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsNotBetweenOrEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsNotBetweenOrEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of values being tested.</typeparam>
[DoesNotReturn]

View File

@ -18,7 +18,7 @@ public static partial class Guard
private static partial class ThrowHelper
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCloseTo(int,int,uint,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCloseTo(int,int,uint,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCloseTo(int value, int target, uint delta, string name)
@ -27,7 +27,7 @@ public static void ThrowArgumentExceptionForIsCloseTo(int value, int target, uin
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCloseTo(int,int,uint,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCloseTo(int,int,uint,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCloseTo(int value, int target, uint delta, string name)
@ -36,7 +36,7 @@ public static void ThrowArgumentExceptionForIsNotCloseTo(int value, int target,
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCloseTo(long,long,ulong,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCloseTo(long,long,ulong,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCloseTo(long value, long target, ulong delta, string name)
@ -45,7 +45,7 @@ public static void ThrowArgumentExceptionForIsCloseTo(long value, long target, u
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCloseTo(long,long,ulong,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCloseTo(long,long,ulong,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCloseTo(long value, long target, ulong delta, string name)
@ -54,7 +54,7 @@ public static void ThrowArgumentExceptionForIsNotCloseTo(long value, long target
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCloseTo(float,float,float,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCloseTo(float,float,float,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCloseTo(float value, float target, float delta, string name)
@ -63,7 +63,7 @@ public static void ThrowArgumentExceptionForIsCloseTo(float value, float target,
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCloseTo(float,float,float,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCloseTo(float,float,float,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCloseTo(float value, float target, float delta, string name)
@ -72,7 +72,7 @@ public static void ThrowArgumentExceptionForIsNotCloseTo(float value, float targ
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCloseTo(double,double,double,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCloseTo(double,double,double,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCloseTo(double value, double target, double delta, string name)
@ -81,7 +81,7 @@ public static void ThrowArgumentExceptionForIsCloseTo(double value, double targe
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCloseTo(double,double,double,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCloseTo(double,double,double,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCloseTo(double value, double target, double delta, string name)
@ -90,7 +90,7 @@ public static void ThrowArgumentExceptionForIsNotCloseTo(double value, double ta
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCloseTo(nint,nint,nuint,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCloseTo(nint,nint,nuint,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCloseTo(nint value, nint target, nuint delta, string name)
@ -99,7 +99,7 @@ public static void ThrowArgumentExceptionForIsCloseTo(nint value, nint target, n
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCloseTo(nint,nint,nuint,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCloseTo(nint,nint,nuint,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCloseTo(nint value, nint target, nuint delta, string name)

View File

@ -19,7 +19,7 @@ public static partial class Guard
private static partial class ThrowHelper
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.CanRead"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="CanRead"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForCanRead(Stream stream, string name)
@ -28,7 +28,7 @@ public static void ThrowArgumentExceptionForCanRead(Stream stream, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.CanWrite"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="CanWrite"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForCanWrite(Stream stream, string name)
@ -37,7 +37,7 @@ public static void ThrowArgumentExceptionForCanWrite(Stream stream, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.CanSeek"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="CanSeek"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForCanSeek(Stream stream, string name)
@ -46,7 +46,7 @@ public static void ThrowArgumentExceptionForCanSeek(Stream stream, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsAtStartPosition"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsAtStartPosition"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsAtStartPosition(Stream stream, string name)

View File

@ -19,7 +19,7 @@ public static partial class Guard
private static partial class ThrowHelper
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNullOrEmpty"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNullOrEmpty"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNullOrEmpty(string? text, string name)
@ -28,7 +28,7 @@ public static void ThrowArgumentExceptionForIsNullOrEmpty(string? text, string n
}
/// <summary>
/// Throws an <see cref="ArgumentNullException"/> or <see cref="ArgumentException"/> when <see cref="Guard.IsNotNullOrEmpty"/> fails.
/// Throws an <see cref="ArgumentNullException"/> or <see cref="ArgumentException"/> when <see cref="IsNotNullOrEmpty"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotNullOrEmpty(string? text, string name)
@ -48,7 +48,7 @@ static Exception GetException(string? text, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNullOrWhitespace"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNullOrWhitespace"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNullOrWhiteSpace(string? text, string name)
@ -57,7 +57,7 @@ public static void ThrowArgumentExceptionForIsNullOrWhiteSpace(string? text, str
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotNullOrWhitespace"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotNullOrWhitespace"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotNullOrWhiteSpace(string? text, string name)
@ -77,7 +77,7 @@ static Exception GetException(string? text, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsEmpty"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsEmpty"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsEmpty(string text, string name)
@ -86,7 +86,7 @@ public static void ThrowArgumentExceptionForIsEmpty(string text, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotEmpty"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotEmpty"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotEmpty(string text, string name)
@ -95,7 +95,7 @@ public static void ThrowArgumentExceptionForIsNotEmpty(string text, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsWhitespace"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsWhitespace"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsWhiteSpace(string text, string name)
@ -104,7 +104,7 @@ public static void ThrowArgumentExceptionForIsWhiteSpace(string text, string nam
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotWhitespace"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotWhitespace"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotWhiteSpace(string text, string name)
@ -113,7 +113,7 @@ public static void ThrowArgumentExceptionForIsNotWhiteSpace(string text, string
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeEqualTo(string,int,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeEqualTo(string,int,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeEqualTo(string text, int size, string name)
@ -122,7 +122,7 @@ public static void ThrowArgumentExceptionForHasSizeEqualTo(string text, int size
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeNotEqualTo"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeNotEqualTo"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeNotEqualTo(string text, int size, string name)
@ -131,7 +131,7 @@ public static void ThrowArgumentExceptionForHasSizeNotEqualTo(string text, int s
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeGreaterThan"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeGreaterThan"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeGreaterThan(string text, int size, string name)
@ -140,7 +140,7 @@ public static void ThrowArgumentExceptionForHasSizeGreaterThan(string text, int
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeGreaterThanOrEqualTo"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeGreaterThanOrEqualTo"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(string text, int size, string name)
@ -149,7 +149,7 @@ public static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(string t
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThan"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeLessThan"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeLessThan(string text, int size, string name)
@ -158,7 +158,7 @@ public static void ThrowArgumentExceptionForHasSizeLessThan(string text, int siz
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThanOrEqualTo(string,int,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeLessThanOrEqualTo(string,int,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(string text, int size, string name)
@ -167,7 +167,7 @@ public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(string text
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeEqualTo(string,string,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeEqualTo(string,string,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeEqualTo(string source, string destination, string name)
@ -176,7 +176,7 @@ public static void ThrowArgumentExceptionForHasSizeEqualTo(string source, string
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThanOrEqualTo(string,string,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasSizeLessThanOrEqualTo(string,string,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(string source, string destination, string name)
@ -185,7 +185,7 @@ public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo(string sour
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsInRangeFor(int,string,string)"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsInRangeFor(int,string,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, string text, string name)
@ -194,7 +194,7 @@ public static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor(int index, st
}
/// <summary>
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsNotInRangeFor(int,string,string)"/> fails.
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="IsNotInRangeFor(int,string,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor(int index, string text, string name)

View File

@ -19,7 +19,7 @@ public static partial class Guard
private static partial class ThrowHelper
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCompleted"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCompleted"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCompleted(Task task, string name)
@ -28,7 +28,7 @@ public static void ThrowArgumentExceptionForIsCompleted(Task task, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCompleted"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCompleted"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCompleted(Task task, string name)
@ -37,7 +37,7 @@ public static void ThrowArgumentExceptionForIsNotCompleted(Task task, string nam
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCompletedSuccessfully"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCompletedSuccessfully"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCompletedSuccessfully(Task task, string name)
@ -46,7 +46,7 @@ public static void ThrowArgumentExceptionForIsCompletedSuccessfully(Task task, s
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCompletedSuccessfully"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCompletedSuccessfully"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCompletedSuccessfully(Task task, string name)
@ -55,7 +55,7 @@ public static void ThrowArgumentExceptionForIsNotCompletedSuccessfully(Task task
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsFaulted"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsFaulted"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsFaulted(Task task, string name)
@ -64,7 +64,7 @@ public static void ThrowArgumentExceptionForIsFaulted(Task task, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotFaulted"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotFaulted"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotFaulted(Task task, string name)
@ -73,7 +73,7 @@ public static void ThrowArgumentExceptionForIsNotFaulted(Task task, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsCanceled"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCanceled"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsCanceled(Task task, string name)
@ -82,7 +82,7 @@ public static void ThrowArgumentExceptionForIsCanceled(Task task, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotCanceled"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotCanceled"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotCanceled(Task task, string name)
@ -91,7 +91,7 @@ public static void ThrowArgumentExceptionForIsNotCanceled(Task task, string name
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasStatusEqualTo"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasStatusEqualTo"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasStatusEqualTo(Task task, TaskStatus status, string name)
@ -100,7 +100,7 @@ public static void ThrowArgumentExceptionForHasStatusEqualTo(Task task, TaskStat
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasStatusNotEqualTo"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="HasStatusNotEqualTo"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForHasStatusNotEqualTo(Task task, TaskStatus status, string name)

View File

@ -35,7 +35,7 @@ private static string AssertString(object? obj)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNull{T}(T,string)"/> (where <typeparamref name="T"/> is <see langword="class"/>) fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNull{T}(T,string)"/> (where <typeparamref name="T"/> is <see langword="class"/>) fails.
/// </summary>
/// <typeparam name="T">The type of the input value.</typeparam>
[DoesNotReturn]
@ -46,7 +46,7 @@ public static void ThrowArgumentExceptionForIsNull<T>(T value, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNull{T}(T,string)"/> (where <typeparamref name="T"/> is <see langword="struct"/>) fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNull{T}(T,string)"/> (where <typeparamref name="T"/> is <see langword="struct"/>) fails.
/// </summary>
/// <typeparam name="T">The type of the input value.</typeparam>
[DoesNotReturn]
@ -57,7 +57,7 @@ public static void ThrowArgumentExceptionForIsNull<T>(T? value, string name)
}
/// <summary>
/// Throws an <see cref="ArgumentNullException"/> when <see cref="Guard.IsNotNull{T}(T,string)"/> fails.
/// Throws an <see cref="ArgumentNullException"/> when <see cref="IsNotNull{T}(T,string)"/> fails.
/// </summary>
/// <typeparam name="T">The type of the input value.</typeparam>
[DoesNotReturn]
@ -67,7 +67,7 @@ public static void ThrowArgumentNullExceptionForIsNotNull<T>(string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsOfType{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsOfType{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of the input value.</typeparam>
[DoesNotReturn]
@ -77,7 +77,7 @@ public static void ThrowArgumentExceptionForIsOfType<T>(object value, string nam
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotOfType{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotOfType{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of the input value.</typeparam>
[DoesNotReturn]
@ -87,7 +87,7 @@ public static void ThrowArgumentExceptionForIsNotOfType<T>(object value, string
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsOfType"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsOfType"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsOfType(object value, Type type, string name)
@ -96,7 +96,7 @@ public static void ThrowArgumentExceptionForIsOfType(object value, Type type, st
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotOfType"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotOfType"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotOfType(object value, Type type, string name)
@ -105,7 +105,7 @@ public static void ThrowArgumentExceptionForIsNotOfType(object value, Type type,
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsAssignableToType{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsAssignableToType{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type being checked against.</typeparam>
[DoesNotReturn]
@ -115,7 +115,7 @@ public static void ThrowArgumentExceptionForIsAssignableToType<T>(object value,
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsNotAssignableToType{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotAssignableToType{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type being checked against.</typeparam>
[DoesNotReturn]
@ -125,7 +125,7 @@ public static void ThrowArgumentExceptionForIsNotAssignableToType<T>(object valu
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsAssignableToType"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsAssignableToType"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsAssignableToType(object value, Type type, string name)
@ -134,7 +134,7 @@ public static void ThrowArgumentExceptionForIsAssignableToType(object value, Typ
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsAssignableToType"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsAssignableToType"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsNotAssignableToType(object value, Type type, string name)
@ -143,7 +143,7 @@ public static void ThrowArgumentExceptionForIsNotAssignableToType(object value,
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsReferenceEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsReferenceEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of input value being compared.</typeparam>
[DoesNotReturn]
@ -154,7 +154,7 @@ public static void ThrowArgumentExceptionForIsReferenceEqualTo<T>(string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsReferenceNotEqualTo{T}"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsReferenceNotEqualTo{T}"/> fails.
/// </summary>
/// <typeparam name="T">The type of input value being compared.</typeparam>
[DoesNotReturn]
@ -165,7 +165,7 @@ public static void ThrowArgumentExceptionForIsReferenceNotEqualTo<T>(string name
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsTrue(bool,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsTrue(bool,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsTrue(string name)
@ -174,7 +174,7 @@ public static void ThrowArgumentExceptionForIsTrue(string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsTrue(bool,string,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsTrue(bool,string,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsTrue(string name, string message)
@ -183,7 +183,7 @@ public static void ThrowArgumentExceptionForIsTrue(string name, string message)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsFalse(bool,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsFalse(bool,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsFalse(string name)
@ -192,7 +192,7 @@ public static void ThrowArgumentExceptionForIsFalse(string name)
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsFalse(bool,string,string)"/> fails.
/// Throws an <see cref="ArgumentException"/> when <see cref="IsFalse(bool,string,string)"/> fails.
/// </summary>
[DoesNotReturn]
public static void ThrowArgumentExceptionForIsFalse(string name, string message)

View File

@ -186,9 +186,6 @@ private static void ThrowInvalidCastExceptionForGetFrom()
}
}
#pragma warning disable SA1402 // Extensions being declared after the type they apply to
#pragma warning disable SA1204 // Extension class to replace instance methods for Box<T>
/// <summary>
/// Helpers for working with the <see cref="Box{T}"/> type.
/// </summary>

View File

@ -12,8 +12,6 @@
#endif
using BitOperations = CommunityToolkit.HighPerformance.Helpers.Internals.BitOperations;
#nullable enable
namespace CommunityToolkit.HighPerformance.Buffers;
/// <summary>

View File

@ -93,7 +93,6 @@ public static ref T DangerousGetReferenceAt<T>(this T[,] array, int i, int j)
private sealed class RawArray2DData
{
#pragma warning disable CS0649 // Unassigned fields
#pragma warning disable SA1401 // Fields should be private
public IntPtr Length;
public int Height;
public int Width;
@ -101,7 +100,6 @@ private sealed class RawArray2DData
public int WidthLowerBound;
public byte Data;
#pragma warning restore CS0649
#pragma warning restore SA1401
}
#endif

View File

@ -113,7 +113,7 @@ public static ReadOnlyMemory<TTo> Cast<TFrom, TTo>(this ReadOnlyMemory<TFrom> me
return new ArrayMemoryManager<TFrom, TTo>(segment.Array!, segment.Offset, segment.Count).Memory;
}
if (MemoryMarshal.TryGetMemoryManager<TFrom, MemoryManager<TFrom>>(memory, out MemoryManager<TFrom>? memoryManager, out start, out length))
if (MemoryMarshal.TryGetMemoryManager(memory, out MemoryManager<TFrom>? memoryManager, out start, out length))
{
// If the memory manager is the one resulting from a previous cast, we can use it directly to retrieve
// a new manager for the target type that wraps the original data store, instead of creating one that
@ -124,7 +124,7 @@ public static ReadOnlyMemory<TTo> Cast<TFrom, TTo>(this ReadOnlyMemory<TFrom> me
return wrappingManager.GetMemory<TTo>(start, length);
}
return new ProxyMemoryManager<TFrom, TTo>(memoryManager, start, length).Memory;
return new ProxyMemoryManager<TFrom, TTo>(memoryManager!, start, length).Memory;
}
// Throws when the memory instance has an unsupported backing store

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// The portable implementation in this type is originally from CoreFX.
// See https://github.com/dotnet/corefx/blob/release/2.1/src/System.Memory/src/System/SpanHelpers.cs.

View File

@ -82,9 +82,7 @@ public static ref T DangerousGetObjectDataReferenceAt<T>(object obj, IntPtr offs
private sealed class RawObjectData
{
[FieldOffset(0)]
#pragma warning disable SA1401 // Fields should be private
public byte Data;
#pragma warning restore SA1401
}
/// <summary>

View File

@ -493,7 +493,7 @@ internal ReadOnlyMemory2D(ReadOnlyMemory<T> memory, int offset, int height, int
this.instance = array;
this.offset = ObjectMarshal.DangerousGetObjectDataByteOffset(array, ref array.DangerousGetReferenceAt(segment.Offset + offset));
}
else if (MemoryMarshal.TryGetMemoryManager<T, MemoryManager<T>>(memory, out MemoryManager<T>? memoryManager, out int memoryManagerStart, out _))
else if (MemoryMarshal.TryGetMemoryManager(memory, out MemoryManager<T>? memoryManager, out int memoryManagerStart, out _))
{
this.instance = memoryManager;
this.offset = (nint)(uint)(memoryManagerStart + offset);

View File

@ -38,9 +38,9 @@ public static Stream Create(ReadOnlyMemory<byte> memory, bool isReadOnly)
return new MemoryStream<ArrayOwner>(arraySpanSource, isReadOnly);
}
if (MemoryMarshal.TryGetMemoryManager<byte, MemoryManager<byte>>(memory, out MemoryManager<byte>? memoryManager, out int start, out int length))
if (MemoryMarshal.TryGetMemoryManager(memory, out MemoryManager<byte>? memoryManager, out int start, out int length))
{
MemoryManagerOwner memoryManagerSpanSource = new(memoryManager, start, length);
MemoryManagerOwner memoryManagerSpanSource = new(memoryManager!, start, length);
return new MemoryStream<MemoryManagerOwner>(memoryManagerSpanSource, isReadOnly);
}

View File

@ -15,8 +15,6 @@
using CommunityToolkit.Mvvm.SourceGenerators.Extensions;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
#pragma warning disable SA1008
namespace CommunityToolkit.Mvvm.SourceGenerators;
/// <summary>

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// This file is inspired from the MvvmLight library (lbugnion/MvvmLight),
// more info in ThirdPartyNotices.txt in the root of the project.

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// This file is inspired from the MvvmLight library (lbugnion/MvvmLight),
// more info in ThirdPartyNotices.txt in the root of the project.

View File

@ -759,7 +759,6 @@ static Dictionary<string, string> GetDisplayNames(Type type)
return displayName ?? propertyName;
}
#pragma warning disable SA1204
/// <summary>
/// Throws an <see cref="ArgumentNullException"/> when a property name given as input is <see langword="null"/>.
/// </summary>
@ -767,5 +766,4 @@ private static void ThrowArgumentNullExceptionForNullPropertyName()
{
throw new ArgumentNullException("propertyName", "The input property name cannot be null when validating a property");
}
#pragma warning restore SA1204
}

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1300
using System;
using System.ComponentModel;

View File

@ -5,8 +5,6 @@
using System;
using System.Threading;
#nullable enable
namespace CommunityToolkit.Mvvm.DependencyInjection;
/// <summary>

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// This file is inspired from the MvvmLight library (lbugnion/MvvmLight),
// more info in ThirdPartyNotices.txt in the root of the project.

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// This file is inspired from the MvvmLight library (lbugnion/MvvmLight),
// more info in ThirdPartyNotices.txt in the root of the project.

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// The DictionarySlim<TKey, TValue> type is originally from CoreFX labs, see
// the source repository on GitHub at https://github.com/dotnet/corefxlab.

View File

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable SA1512
// This file is inspired from the MvvmLight library (lbugnion/MvvmLight),
// more info in ThirdPartyNotices.txt in the root of the project.

View File

@ -14,8 +14,6 @@
using RecipientsTable = System.Runtime.CompilerServices.ConditionalWeakTable<object, Microsoft.Collections.Extensions.IDictionarySlim>;
#endif
#pragma warning disable SA1204
namespace CommunityToolkit.Mvvm.Messaging;
/// <summary>

View File

@ -72,7 +72,6 @@ public void Test_TypeExtensions_NestedTypes(string name, Type type)
Assert.AreEqual(name, type.ToTypeString());
}
#pragma warning disable SA1015 // Closing generic brackets should be spaced correctly
[TestCategory("TypeExtensions")]
[TestMethod]
[DataRow("void*", typeof(void*))]
@ -88,7 +87,6 @@ public void Test_TypeExtensions_PointerTypes(string name, Type type)
{
Assert.AreEqual(name, type.ToTypeString());
}
#pragma warning restore SA1015
[TestCategory("TypeExtensions")]
[TestMethod]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
@ -15,7 +14,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Buffers;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_ArrayPoolBufferWriterOfT
{
[TestCategory("ArrayPoolBufferWriterOfT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using CommunityToolkit.HighPerformance.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -11,7 +10,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Buffers;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_MemoryBufferWriterOfT
{
[TestCategory("MemoryBufferWriterOfT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using CommunityToolkit.HighPerformance.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -12,7 +11,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Buffers;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_MemoryOwnerOfT
{
[TestCategory("MemoryOwnerOfT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using CommunityToolkit.HighPerformance.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -12,7 +11,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Buffers;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_SpanOwnerOfT
{
[TestCategory("SpanOwnerOfT")]

View File

@ -10,8 +10,6 @@
using CommunityToolkit.HighPerformance.Buffers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#nullable enable
namespace CommunityToolkit.HighPerformance.UnitTests.Buffers;
[TestClass]

View File

@ -5,7 +5,6 @@
#if !WINDOWS_UWP
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using CommunityToolkit.HighPerformance.Enumerables;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -13,7 +12,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Enumerables;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_ReadOnlyRefEnumerable
{
[TestCategory("ReadOnlyRefEnumerable")]

View File

@ -5,7 +5,6 @@
#if !WINDOWS_UWP
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using CommunityToolkit.HighPerformance.Enumerables;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -13,7 +12,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Enumerables;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_RefEnumerable
{
[TestCategory("RefEnumerable")]

View File

@ -153,7 +153,7 @@ public void Test_MemoryExtensions_FromArray_CastFromByteAndBack()
// Here we get the array from the final memory and check that it does exist and
// the associated parameters match the ones we'd expect here (same length, offset of 0).
Assert.IsTrue(MemoryMarshal.TryGetArray<byte>(memoryBack, out ArraySegment<byte> segment));
Assert.IsTrue(MemoryMarshal.TryGetArray(memoryBack, out ArraySegment<byte> segment));
Assert.AreSame(segment.Array!, data);
Assert.AreEqual(segment.Offset, 0);
Assert.AreEqual(segment.Count, data.Length);
@ -261,7 +261,7 @@ public void Test_MemoryExtensions_FromArray_CastFromByteAndBack_WithSlice()
Assert.AreEqual(memoryOfBytes.Length, memoryBack.Length);
// Here we now also have to validate the starting offset from the extracted array
Assert.IsTrue(MemoryMarshal.TryGetArray<byte>(memoryBack, out ArraySegment<byte> segment));
Assert.IsTrue(MemoryMarshal.TryGetArray(memoryBack, out ArraySegment<byte> segment));
Assert.AreSame(segment.Array!, data);
Assert.AreEqual(segment.Offset, 128);
Assert.AreEqual(segment.Count, 128);

View File

@ -3,14 +3,11 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using CommunityToolkit.HighPerformance;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CommunityToolkit.HighPerformance.UnitTests.Buffers.Internals;
#nullable enable
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.HighPerformance.UnitTests.Extensions;
@ -41,7 +38,6 @@ public void Test_ReadOnlySpanExtensions_RandomCount16()
[TestCategory("ReadOnlySpanExtensions")]
[TestMethod]
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1139", Justification = "Easier to tell types apart at a glance")]
public void Test_ReadOnlySpanExtensions_RandomCount32()
{
TestForType((int)37438941, CreateRandomData);
@ -51,7 +47,6 @@ public void Test_ReadOnlySpanExtensions_RandomCount32()
[TestCategory("ReadOnlySpanExtensions")]
[TestMethod]
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1139", Justification = "Easier to tell types apart at a glance")]
public void Test_ReadOnlySpanExtensions_RandomCount64()
{
TestForType((long)47128480128401, CreateRandomData);
@ -149,7 +144,6 @@ public void Test_ReadOnlySpanExtensions_FilledCount16()
[TestCategory("ReadOnlySpanExtensions")]
[TestMethod]
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1139", Justification = "Easier to tell types apart at a glance")]
public void Test_ReadOnlySpanExtensions_FilledCount32()
{
TestForType((int)37438941, (count, _) => CreateFilledData(count, (int)37438941));
@ -158,7 +152,6 @@ public void Test_ReadOnlySpanExtensions_FilledCount32()
[TestCategory("ReadOnlySpanExtensions")]
[TestMethod]
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1139", Justification = "Easier to tell types apart at a glance")]
public void Test_ReadOnlySpanExtensions_FilledCount64()
{
TestForType((long)47128480128401, (count, _) => CreateFilledData(count, (long)47128480128401));

View File

@ -196,7 +196,7 @@ public void Test_ReadOnlySpanExtensions_Enumerate()
int i = 0;
foreach (CommunityToolkit.HighPerformance.Enumerables.ReadOnlySpanEnumerable<int>.Item item in data.Enumerate())
foreach (HighPerformance.Enumerables.ReadOnlySpanEnumerable<int>.Item item in data.Enumerate())
{
Assert.IsTrue(Unsafe.AreSame(ref Unsafe.AsRef(data[i]), ref Unsafe.AsRef(item.Value)));
Assert.AreEqual(i, item.Index);
@ -211,7 +211,7 @@ public void Test_ReadOnlySpanExtensions_Enumerate_Empty()
{
ReadOnlySpan<int> data = Array.Empty<int>();
foreach (CommunityToolkit.HighPerformance.Enumerables.ReadOnlySpanEnumerable<int>.Item item in data.Enumerate())
foreach (HighPerformance.Enumerables.ReadOnlySpanEnumerable<int>.Item item in data.Enumerate())
{
Assert.Fail("Empty source sequence");
}

View File

@ -148,7 +148,7 @@ public void Test_SpanExtensions_Enumerate()
int i = 0;
foreach (CommunityToolkit.HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.Enumerate())
foreach (HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.Enumerate())
{
Assert.IsTrue(Unsafe.AreSame(ref data[i], ref item.Value));
Assert.AreEqual(i, item.Index);
@ -163,7 +163,7 @@ public void Test_SpanExtensions_Enumerate_Empty()
{
Span<int> data = Array.Empty<int>();
foreach (CommunityToolkit.HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.Enumerate())
foreach (HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.Enumerate())
{
Assert.Fail("Empty source sequence");
}

View File

@ -2,7 +2,6 @@
// 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.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -66,7 +65,6 @@ public void Test_ArrayExtensions_Ref()
/// </summary>
private sealed class SpinLockOwner
{
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401", Justification = "Quick ref access for tests")]
public SpinLock Lock;
}
}

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using CommunityToolkit.HighPerformance.Helpers;
@ -13,7 +12,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests.Helpers;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_HashCodeOfT
{
/// <summary>

View File

@ -29,7 +29,7 @@ public unsafe void Test_ParallelHelper_ForWithIndices()
ParallelHelper.For(0, data.Length, new Assigner(data.Length, data.Ptr));
foreach (CommunityToolkit.HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.GetSpan().Enumerate())
foreach (HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.GetSpan().Enumerate())
{
if (item.Index != item.Value)
{
@ -68,7 +68,7 @@ public unsafe void Test_ParallelHelper_ForWithRanges()
ParallelHelper.For(..data.Length, new Assigner(data.Length, data.Ptr));
foreach (CommunityToolkit.HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.GetSpan().Enumerate())
foreach (HighPerformance.Enumerables.SpanEnumerable<int>.Item item in data.GetSpan().Enumerate())
{
if (item.Index != item.Value)
{

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
#if !WINDOWS_UWP
using System.Runtime.CompilerServices;
#endif
@ -12,7 +11,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_Memory2DT
{
[TestCategory("Memory2DT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
#if !WINDOWS_UWP
using System.Runtime.CompilerServices;
#endif
@ -19,7 +18,6 @@ namespace CommunityToolkit.HighPerformance.UnitTests;
* or some checks being done upon construction. See comments in the test
* file for Memory2D<T> for more info on these tests. */
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_ReadOnlyMemory2DT
{
[TestCategory("ReadOnlyMemory2DT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using CommunityToolkit.HighPerformance.Enumerables;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -16,7 +15,6 @@ namespace CommunityToolkit.HighPerformance.UnitTests;
* All the tests here mirror the ones for ReadOnlySpan2D<T>. See comments
* in the test file for Span2D<T> for more info on these tests. */
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_ReadOnlySpan2DT
{
[TestCategory("ReadOnlySpan2DT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using CommunityToolkit.HighPerformance.Enumerables;
@ -12,7 +11,6 @@
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_Span2DT
{
[TestCategory("Span2DT")]

View File

@ -104,7 +104,7 @@ public void Test_IBufferWriterStream_WriteByte()
ReadOnlySpan<byte> data = stackalloc byte[] { 1, 128, 255, 32 };
foreach (CommunityToolkit.HighPerformance.Enumerables.ReadOnlySpanEnumerable<byte>.Item item in data.Enumerate())
foreach (HighPerformance.Enumerables.ReadOnlySpanEnumerable<byte>.Item item in data.Enumerate())
{
// Since we're enumerating, we can also double check the current written count
// at each iteration, to ensure the writes are done correctly every time.

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.IO;
using System.Runtime.InteropServices;
@ -182,14 +181,13 @@ public async Task Test_MemoryStream_ReadWriteAsync_Array()
[TestCategory("MemoryStream")]
[TestMethod]
[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1500", Justification = "Array initialization")]
public void Test_MemoryStream_ReadWriteByte()
{
Stream stream = new byte[4].AsMemory().AsStream();
ReadOnlySpan<byte> data = stackalloc byte[] { 1, 128, 255, 32 };
foreach (CommunityToolkit.HighPerformance.Enumerables.ReadOnlySpanEnumerable<byte>.Item item in data.Enumerate())
foreach (HighPerformance.Enumerables.ReadOnlySpanEnumerable<byte>.Item item in data.Enumerate())
{
Assert.AreEqual(stream.Position, item.Index);

View File

@ -3,13 +3,11 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_BoxOfT
{
[TestCategory("BoxOfT")]

View File

@ -5,14 +5,12 @@
#if NETCOREAPP3_1 || NET5_0
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_NullableReadOnlyRefOfT
{
[TestCategory("NullableReadOnlyRefOfT")]

View File

@ -5,14 +5,12 @@
#if NETCOREAPP3_1 || NET5_0
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_NullableRefOfT
{
[TestCategory("NullableRefOfT")]

View File

@ -2,14 +2,12 @@
// 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.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_ReadOnlyRefOfT
{
[TestCategory("ReadOnlyRefOfT")]

View File

@ -2,14 +2,12 @@
// 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.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.HighPerformance.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
public class Test_RefOfT
{
[TestCategory("RefOfT")]

View File

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Input;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -11,7 +10,6 @@
namespace CommunityToolkit.Mvvm.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Generic type")]
public class Test_AsyncRelayCommandOfT
{
[TestCategory("Mvvm")]

View File

@ -2,17 +2,13 @@
// 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.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Input;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#pragma warning disable SA1124
namespace CommunityToolkit.Mvvm.UnitTests;
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
[TestClass]
public partial class Test_ICommandAttribute
{

View File

@ -4,14 +4,12 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.Mvvm.UnitTests;
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
[TestClass]
public partial class Test_INotifyPropertyChangedAttribute
{

View File

@ -2,16 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#pragma warning disable CS0618
using System;
using System.Diagnostics.CodeAnalysis;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#pragma warning disable CS0618
namespace CommunityToolkit.Mvvm.UnitTests;
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
[TestClass]
public partial class Test_IRecipientGenerator
{
@ -25,7 +23,7 @@ public void Test_IRecipientGenerator_GeneratedRegistration()
MessageA? messageA = new();
MessageB? messageB = new();
Action<IMessenger, object, int> registrator = CommunityToolkit.Mvvm.Messaging.__Internals.__IMessengerExtensions.CreateAllMessagesRegistratorWithToken<int>(recipient);
Action<IMessenger, object, int> registrator = Messaging.__Internals.__IMessengerExtensions.CreateAllMessagesRegistratorWithToken<int>(recipient);
registrator(messenger, recipient, 42);

View File

@ -3,13 +3,11 @@
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.Mvvm.UnitTests;
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
[TestClass]
public partial class Test_ObservableObjectAttribute
{

View File

@ -6,19 +6,13 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#pragma warning disable SA1124, SA1307, SA1401
#nullable enable
namespace CommunityToolkit.Mvvm.UnitTests;
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
[TestClass]
public partial class Test_ObservablePropertyAttribute
{

View File

@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using CommunityToolkit.Mvvm.ComponentModel;
@ -14,7 +13,6 @@
namespace CommunityToolkit.Mvvm.UnitTests;
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
[TestClass]
public partial class Test_ObservableRecipientAttribute
{

View File

@ -3,14 +3,12 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.CodeAnalysis;
using CommunityToolkit.Mvvm.Input;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CommunityToolkit.Mvvm.UnitTests;
[TestClass]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Generic type")]
public class Test_RelayCommandOfT
{
[TestCategory("Mvvm")]