-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: copy MemberNotNull attribute internally for use with NETSTANDARD…
…2.1 code
- Loading branch information
Showing
2 changed files
with
37 additions
and
11 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/bunit.core/System.Diagnostics.CodeAnalysis/MemberNotNullAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#if NETSTANDARD2_1 | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Diagnostics.CodeAnalysis; | ||
|
||
/// <summary> | ||
/// Specifies that the method or property will ensure that the listed field and property members have not-null values. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] | ||
internal sealed class MemberNotNullAttribute : Attribute | ||
{ | ||
/// <summary>Initializes the attribute with a field or property member.</summary> | ||
/// <param name="member"> | ||
/// The field or property member that is promised to be not-null. | ||
/// </param> | ||
[SuppressMessage("Design", "CA1019:Define accessors for attribute arguments", Justification = "Copied from dotnet team.")] | ||
public MemberNotNullAttribute(string member) => Members = new[] { member }; | ||
|
||
/// <summary>Initializes the attribute with the list of field and property members.</summary> | ||
/// <param name="members"> | ||
/// The list of field and property members that are promised to be not-null. | ||
/// </param> | ||
public MemberNotNullAttribute(params string[] members) => Members = members; | ||
|
||
/// <summary>Gets field or property member names.</summary> | ||
public string[] Members { get; } | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters