Skip to content

Commit e489e32

Browse files
authored
Merge pull request #481 from CommunityToolkit/dev/net7-hp
Add .NET 7 TFM to HighPerformance target, switch to C# 11
2 parents 040b676 + 2a9cb1d commit e489e32

36 files changed

+669
-856
lines changed

CommunityToolkit.Common/CommunityToolkit.Common.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
<PackageTags>Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;Extensions;Helpers</PackageTags>
1515
</PropertyGroup>
1616

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

2522
</Project>

CommunityToolkit.Common/Extensions/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static bool IsNumeric([NotNullWhen(true)] this string? str)
9696
/// </summary>
9797
/// <param name="htmlText">HTML string.</param>
9898
/// <returns>Decoded HTML string.</returns>
99-
[return: NotNullIfNotNull("htmlText")]
99+
[return: NotNullIfNotNull(nameof(htmlText))]
100100
public static string? DecodeHtml(this string? htmlText)
101101
{
102102
if (htmlText is null)

CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
<When Condition="'$(TargetFramework)' == 'net6.0'">
3939
<PropertyGroup>
4040
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
41-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
42-
<IsTrimmable>true</IsTrimmable>
4341
</PropertyGroup>
4442
</When>
4543
</Choose>

CommunityToolkit.Diagnostics/Generated/Guard.Collection.g.cs

Lines changed: 96 additions & 96 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/Guard.Collection.tt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GenerateTextForItems(EnumerableTypes, item =>
2323
/// <param name="name">The name of the input parameter being tested.</param>
2424
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is != 0.</exception>
2525
[MethodImpl(MethodImplOptions.AggressiveInlining)]
26-
public static void IsEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
26+
public static void IsEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
2727
{
2828
if (<#=item.Name#>.<#=item.Size#> == 0)
2929
{
@@ -41,7 +41,7 @@ GenerateTextForItems(EnumerableTypes, item =>
4141
/// <param name="name">The name of the input parameter being tested.</param>
4242
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is == 0.</exception>
4343
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44-
public static void IsNotEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
44+
public static void IsNotEmpty<T>(<#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
4545
{
4646
if (<#=item.Name#>.<#=item.Size#> != 0)
4747
{
@@ -79,7 +79,7 @@ else
7979
/// <param name="name">The name of the input parameter being tested.</param>
8080
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is != <paramref name="size"/>.</exception>
8181
[MethodImpl(MethodImplOptions.AggressiveInlining)]
82-
public static void HasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
82+
public static void HasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
8383
{
8484
if (<#=item.Name#>.<#=item.Size#> == size)
8585
{
@@ -98,7 +98,7 @@ else
9898
/// <param name="name">The name of the input parameter being tested.</param>
9999
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is == <paramref name="size"/>.</exception>
100100
[MethodImpl(MethodImplOptions.AggressiveInlining)]
101-
public static void HasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
101+
public static void HasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
102102
{
103103
if (<#=item.Name#>.<#=item.Size#> != size)
104104
{
@@ -117,7 +117,7 @@ else
117117
/// <param name="name">The name of the input parameter being tested.</param>
118118
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is &lt;= <paramref name="size"/>.</exception>
119119
[MethodImpl(MethodImplOptions.AggressiveInlining)]
120-
public static void HasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
120+
public static void HasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
121121
{
122122
if (<#=item.Name#>.<#=item.Size#> > size)
123123
{
@@ -136,7 +136,7 @@ else
136136
/// <param name="name">The name of the input parameter being tested.</param>
137137
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is &lt; <paramref name="size"/>.</exception>
138138
[MethodImpl(MethodImplOptions.AggressiveInlining)]
139-
public static void HasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
139+
public static void HasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
140140
{
141141
if (<#=item.Name#>.<#=item.Size#> >= size)
142142
{
@@ -155,7 +155,7 @@ else
155155
/// <param name="name">The name of the input parameter being tested.</param>
156156
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is >= <paramref name="size"/>.</exception>
157157
[MethodImpl(MethodImplOptions.AggressiveInlining)]
158-
public static void HasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
158+
public static void HasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
159159
{
160160
if (<#=item.Name#>.<#=item.Size#> < size)
161161
{
@@ -174,7 +174,7 @@ else
174174
/// <param name="name">The name of the input parameter being tested.</param>
175175
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="<#=item.Name#>"/> is > <paramref name="size"/>.</exception>
176176
[MethodImpl(MethodImplOptions.AggressiveInlining)]
177-
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression("<#=item.Name#>")] string name = "")
177+
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, [CallerArgumentExpression(nameof(<#=item.Name#>))] string name = "")
178178
{
179179
if (<#=item.Name#>.<#=item.Size#> <= size)
180180
{
@@ -193,7 +193,7 @@ else
193193
/// <param name="name">The name of the input parameter being tested.</param>
194194
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="source"/> is != the one of <paramref name="destination"/>.</exception>
195195
[MethodImpl(MethodImplOptions.AggressiveInlining)]
196-
public static void HasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression("source")] string name = "")
196+
public static void HasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression(nameof(source))] string name = "")
197197
{
198198
if (source.<#=item.Size#> == destination.<#=item.Size#>)
199199
{
@@ -225,7 +225,7 @@ else
225225
/// <param name="name">The name of the input parameter being tested.</param>
226226
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="source"/> is > the one of <paramref name="destination"/>.</exception>
227227
[MethodImpl(MethodImplOptions.AggressiveInlining)]
228-
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression("source")] string name = "")
228+
public static void HasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, [CallerArgumentExpression(nameof(source))] string name = "")
229229
{
230230
if (source.<#=item.Size#> <= destination.<#=item.Size#>)
231231
{
@@ -257,7 +257,7 @@ else
257257
/// <param name="name">The name of the input parameter being tested.</param>
258258
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="index"/> is not valid to access <paramref name="<#=item.Name#>"/>.</exception>
259259
[MethodImpl(MethodImplOptions.AggressiveInlining)]
260-
public static void IsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("index")] string name = "")
260+
public static void IsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(index))] string name = "")
261261
{
262262
<#
263263
// Here we're leveraging the fact that signed integers are represented
@@ -283,7 +283,7 @@ else
283283
/// <param name="name">The name of the input parameter being tested.</param>
284284
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="index"/> is valid to access <paramref name="<#=item.Name#>"/>.</exception>
285285
[MethodImpl(MethodImplOptions.AggressiveInlining)]
286-
public static void IsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression("index")] string name = "")
286+
public static void IsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, [CallerArgumentExpression(nameof(index))] string name = "")
287287
{
288288
if ((uint)index >= (uint)<#=item.Name#>.<#=item.Size#>)
289289
{

0 commit comments

Comments
 (0)