1
0
mirror of https://github.com/chylex/.NET-Community-Toolkit.git synced 2025-08-13 16:17:00 +02:00

Add [SkipLocalsInit] to missing assemblies

This commit is contained in:
Sergio Pedri
2022-01-01 16:54:47 +01:00
parent ef77d0973d
commit 57f4c3d97d
6 changed files with 73 additions and 1 deletions
CommunityToolkit.Common
CommunityToolkit.Diagnostics
CommunityToolkit.Mvvm/Properties

@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#if !NET6_0_OR_GREATER
namespace System.Runtime.CompilerServices;
/// <summary>
/// Used to indicate to the compiler that the <c>.locals init</c> flag should not be set in method headers.
/// </summary>
/// <remarks>Internal copy of the .NET 5 attribute.</remarks>
[AttributeUsage(
AttributeTargets.Module |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Interface |
AttributeTargets.Constructor |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Event,
Inherited = false)]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
#endif

@@ -0,0 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.Runtime.CompilerServices;
// See notes in CommunityToolkit.HighPerformance for more info
[module: SkipLocalsInit]

@@ -41,7 +41,6 @@ public static class ValueTypeExtensions
/// Console.WriteLine((-1).ToHexString()); // "0xFFFFFFFF"
/// </code>
/// </remarks>
[SkipLocalsInit]
public static unsafe string ToHexString<T>(this T value)
where T : unmanaged
{

@@ -0,0 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.Runtime.CompilerServices;
// See notes in CommunityToolkit.HighPerformance for more info
[module: SkipLocalsInit]

@@ -4,4 +4,7 @@
using System.Runtime.CompilerServices;
// See notes in CommunityToolkit.HighPerformance for more info
[module: SkipLocalsInit]
[assembly: InternalsVisibleTo("CommunityToolkit.Mvvm.Internals.UnitTests")]

@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#if !NET6_0_OR_GREATER
namespace System.Runtime.CompilerServices;
/// <summary>
/// Used to indicate to the compiler that the <c>.locals init</c> flag should not be set in method headers.
/// </summary>
/// <remarks>Internal copy from the BCL attribute.</remarks>
[AttributeUsage(
AttributeTargets.Module |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Interface |
AttributeTargets.Constructor |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Event,
Inherited = false)]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
#endif