Skip to content

Commit 57f4c3d

Browse files
committed
Add [SkipLocalsInit] to missing assemblies
1 parent ef77d09 commit 57f4c3d

File tree

6 files changed

+73
-1
lines changed

6 files changed

+73
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
#if !NET6_0_OR_GREATER
6+
7+
namespace System.Runtime.CompilerServices;
8+
9+
/// <summary>
10+
/// Used to indicate to the compiler that the <c>.locals init</c> flag should not be set in method headers.
11+
/// </summary>
12+
/// <remarks>Internal copy of the .NET 5 attribute.</remarks>
13+
[AttributeUsage(
14+
AttributeTargets.Module |
15+
AttributeTargets.Class |
16+
AttributeTargets.Struct |
17+
AttributeTargets.Interface |
18+
AttributeTargets.Constructor |
19+
AttributeTargets.Method |
20+
AttributeTargets.Property |
21+
AttributeTargets.Event,
22+
Inherited = false)]
23+
internal sealed class SkipLocalsInitAttribute : Attribute
24+
{
25+
}
26+
27+
#endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Runtime.CompilerServices;
6+
7+
// See notes in CommunityToolkit.HighPerformance for more info
8+
[module: SkipLocalsInit]

CommunityToolkit.Diagnostics/Extensions/ValueTypeExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public static class ValueTypeExtensions
4141
/// Console.WriteLine((-1).ToHexString()); // "0xFFFFFFFF"
4242
/// </code>
4343
/// </remarks>
44-
[SkipLocalsInit]
4544
public static unsafe string ToHexString<T>(this T value)
4645
where T : unmanaged
4746
{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Runtime.CompilerServices;
6+
7+
// See notes in CommunityToolkit.HighPerformance for more info
8+
[module: SkipLocalsInit]

CommunityToolkit.Mvvm/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44

55
using System.Runtime.CompilerServices;
66

7+
// See notes in CommunityToolkit.HighPerformance for more info
8+
[module: SkipLocalsInit]
9+
710
[assembly: InternalsVisibleTo("CommunityToolkit.Mvvm.Internals.UnitTests")]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
#if !NET6_0_OR_GREATER
6+
7+
namespace System.Runtime.CompilerServices;
8+
9+
/// <summary>
10+
/// Used to indicate to the compiler that the <c>.locals init</c> flag should not be set in method headers.
11+
/// </summary>
12+
/// <remarks>Internal copy from the BCL attribute.</remarks>
13+
[AttributeUsage(
14+
AttributeTargets.Module |
15+
AttributeTargets.Class |
16+
AttributeTargets.Struct |
17+
AttributeTargets.Interface |
18+
AttributeTargets.Constructor |
19+
AttributeTargets.Method |
20+
AttributeTargets.Property |
21+
AttributeTargets.Event,
22+
Inherited = false)]
23+
internal sealed class SkipLocalsInitAttribute : Attribute
24+
{
25+
}
26+
27+
#endif

0 commit comments

Comments
 (0)