Skip to content

Commit

Permalink
fix: Added missing ExcludeFromCodeCoverage on nullability objects (#81
Browse files Browse the repository at this point in the history
)

to reduce the code coverage impact, when Polyfill is used.
  • Loading branch information
samtrion authored Aug 29, 2023
1 parent f56b507 commit 9435ff9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Polyfill/Nullability/NullabilityInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;

namespace System.Reflection
{
/// <summary>
/// A class that represents nullability info
/// </summary>
#if PolyPublic
[ExcludeFromCodeCoverage]
#if PolyPublic
public
#endif
sealed class NullabilityInfo
sealed class NullabilityInfo
{
internal NullabilityInfo(Type type, NullabilityState readState, NullabilityState writeState,
NullabilityInfo? elementType, NullabilityInfo[] typeArguments)
Expand Down
7 changes: 5 additions & 2 deletions src/Polyfill/Nullability/NullabilityInfoContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Reflection
{
/// <summary>
/// Provides APIs for populating nullability information/context from reflection members:
/// <see cref="ParameterInfo"/>, <see cref="FieldInfo"/>, <see cref="PropertyInfo"/> and <see cref="EventInfo"/>.
/// </summary>
#if PolyPublic
[ExcludeFromCodeCoverage]
#if PolyPublic
public
#endif
sealed class NullabilityInfoContext
sealed class NullabilityInfoContext
{
private const string CompilerServicesNameSpace = "System.Runtime.CompilerServices";
private readonly Dictionary<Module, NotAnnotatedStatus> _publicOnlyModules = new();
Expand Down Expand Up @@ -632,6 +634,7 @@ private static NullabilityState TranslateByte(byte b) =>
private static bool IsValueTypeOrValueTypeByRef(Type type) =>
type.IsValueType || ((type.IsByRef || type.IsPointer) && type.GetElementType()!.IsValueType);

[ExcludeFromCodeCoverage]
private readonly struct NullableAttributeStateParser
{
private static readonly object UnknownByte = (byte)0;
Expand Down

0 comments on commit 9435ff9

Please sign in to comment.