Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .NET 7 TFM to HighPerformance target, switch to C# 11 #481

Merged
merged 6 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions CommunityToolkit.Common/CommunityToolkit.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
<PackageTags>Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;Extensions;Helpers</PackageTags>
</PropertyGroup>

<!-- .NET Standard 2.1 and .NET 6 already have [NotNullIfNotNull] and [NotNullWhen].
Additionally, also enable trimming support on .NET 6. -->
<!-- .NET Standard 2.1 and .NET 6 already have [NotNullIfNotNull] and [NotNullWhen] -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion CommunityToolkit.Common/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static bool IsNumeric([NotNullWhen(true)] this string? str)
/// </summary>
/// <param name="htmlText">HTML string.</param>
/// <returns>Decoded HTML string.</returns>
[return: NotNullIfNotNull("htmlText")]
[return: NotNullIfNotNull(nameof(htmlText))]
public static string? DecodeHtml(this string? htmlText)
{
if (htmlText is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<When Condition="'$(TargetFramework)' == 'net6.0'">
<PropertyGroup>
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
</When>
</Choose>
Expand Down
192 changes: 96 additions & 96 deletions CommunityToolkit.Diagnostics/Generated/Guard.Collection.g.cs

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions CommunityToolkit.Diagnostics/Generated/Guard.Collection.tt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GenerateTextForItems(EnumerableTypes, item =>
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is != 0.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void IsEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> == 0)
{
Expand All @@ -41,7 +41,7 @@ GenerateTextForItems(EnumerableTypes, item =>
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is == 0.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsNotEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void IsNotEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> != 0)
{
Expand Down Expand Up @@ -79,7 +79,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is != <paramref name="size"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void HasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> == size)
{
Expand All @@ -98,7 +98,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is == <paramref name="size"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void HasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> != size)
{
Expand All @@ -117,7 +117,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is &lt;= <paramref name="size"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void HasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> > size)
{
Expand All @@ -136,7 +136,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is &lt; <paramref name="size"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void HasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> >= size)
{
Expand All @@ -155,7 +155,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is >= <paramref name="size"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void HasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> < size)
{
Expand All @@ -174,7 +174,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is > <paramref name="size"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
{
if (<#=item.Name#>.<#=item.Size#> <= size)
{
Expand All @@ -193,7 +193,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="source"/> is != the one of <paramref name="destination"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression("source")] string name = "")
public static void HasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression(nameof(source))] string name = "")
{
if (source.<#=item.Size#> == destination.<#=item.Size#>)
{
Expand Down Expand Up @@ -225,7 +225,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="source"/> is > the one of <paramref name="destination"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression("source")] string name = "")
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression(nameof(source))] string name = "")
{
if (source.<#=item.Size#> <= destination.<#=item.Size#>)
{
Expand Down Expand Up @@ -257,7 +257,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="index"/> is not valid to access <paramref name="<#=item.Name#>"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("index")] string name = "")
public static void IsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(index))] string name = "")
{
<#
// Here we're leveraging the fact that signed integers are represented
Expand All @@ -283,7 +283,7 @@ else
/// <param name="name">The name of the input parameter being tested.</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="index"/> is valid to access <paramref name="<#=item.Name#>"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("index")] string name = "")
public static void IsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(index))] string name = "")
{
if ((uint)index >= (uint)<#=item.Name#>.<#=item.Size#>)
{
Expand Down
Loading