@@ -2,6 +2,7 @@ namespace ScriptCs
22{
33 using System ;
44 using System . Diagnostics ;
5+ using System . Diagnostics . CodeAnalysis ;
56 using System . Globalization ;
67
78 /// <summary>
@@ -17,6 +18,7 @@ internal static class Guard
1718 /// <param name="argument">The argument.</param>
1819 /// <exception cref="System.ArgumentNullException"><paramref name="argument" /> is <c>null</c>.</exception>
1920 /// <remarks><typeparamref name="TArgument"/> is restricted to reference types to avoid boxing of value type objects.</remarks>
21+ [ SuppressMessage ( "Microsoft.Performance" , "CA1811:AvoidUncalledPrivateCode" , Justification = "Distributed as a source code package." ) ]
2022 [ DebuggerStepThrough ]
2123 public static void AgainstNullArgument < TArgument > ( string parameterName , [ ValidatedNotNull ] TArgument argument ) where TArgument : class
2224 {
@@ -36,6 +38,7 @@ public static void AgainstNullArgument<TArgument>(string parameterName, [Validat
3638 /// <remarks>
3739 /// Performs a type check to avoid boxing of value type objects.
3840 /// </remarks>
41+ [ SuppressMessage ( "Microsoft.Performance" , "CA1811:AvoidUncalledPrivateCode" , Justification = "Distributed as a source code package." ) ]
3942 [ DebuggerStepThrough ]
4043 public static void AgainstNullArgumentIfNullable < TArgument > ( string parameterName , [ ValidatedNotNull ] TArgument argument )
4144 {
@@ -54,6 +57,7 @@ public static void AgainstNullArgumentIfNullable<TArgument>(string parameterName
5457 /// <param name="argumentProperty">The argument property.</param>
5558 /// <exception cref="System.ArgumentException"><paramref name="argumentProperty" /> is <c>null</c>.</exception>
5659 /// <remarks><typeparamref name="TProperty"/> is restricted to reference types to avoid boxing of value type objects.</remarks>
60+ [ SuppressMessage ( "Microsoft.Performance" , "CA1811:AvoidUncalledPrivateCode" , Justification = "Distributed as a source code package." ) ]
5761 [ DebuggerStepThrough ]
5862 public static void AgainstNullArgumentProperty < TProperty > ( string parameterName , string propertyName , [ ValidatedNotNull ] TProperty argumentProperty )
5963 where TProperty : class
@@ -75,6 +79,7 @@ public static void AgainstNullArgumentProperty<TProperty>(string parameterName,
7579 /// <remarks>
7680 /// Performs a type check to avoid boxing of value type objects.
7781 /// </remarks>
82+ [ SuppressMessage ( "Microsoft.Performance" , "CA1811:AvoidUncalledPrivateCode" , Justification = "Distributed as a source code package." ) ]
7883 [ DebuggerStepThrough ]
7984 public static void AgainstNullArgumentPropertyIfNullable < TProperty > (
8085 string parameterName , string propertyName , [ ValidatedNotNull ] TProperty argumentProperty )
@@ -85,12 +90,22 @@ public static void AgainstNullArgumentPropertyIfNullable<TProperty>(
8590 }
8691 }
8792
93+ /// <summary>
94+ /// Determines whether the specified type is a nullable type.
95+ /// </summary>
96+ /// <param name="type">The type.</param>
97+ /// <returns>
98+ /// <c>true</c> if the specified type is a nullable type; otherwise, <c>false</c>.
99+ /// </returns>
100+ [ SuppressMessage ( "Microsoft.Performance" , "CA1811:AvoidUncalledPrivateCode" , Justification = "Distributed as a source code package." ) ]
88101 private static bool IsNullableType ( this Type type )
89102 {
90103 return ! type . IsValueType || ( type . IsGenericType && type . GetGenericTypeDefinition ( ) == typeof ( Nullable < > ) ) ;
91104 }
92105
93- // NOTE: when applied to a parameter, this attribute provides an indication to code analysis that the argument has been null checked
106+ /// <summary>
107+ /// When applied to a parameter, this attribute provides an indication to code analysis that the argument has been null checked.
108+ /// </summary>
94109 private sealed class ValidatedNotNullAttribute : Attribute
95110 {
96111 }
0 commit comments