Skip to content

Commit

Permalink
Add polyfills for FeatureGuardAttribute and `FeatureSwitchDefinitio…
Browse files Browse the repository at this point in the history
…nAttribute` (#18)
  • Loading branch information
Tyrrrz authored Nov 12, 2024
1 parent 4505056 commit 966037c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions PolyShim/Net90/FeatureGuardAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// The following comment is required to instruct analyzers to skip this file
// <auto-generated/>

#if (NETCOREAPP && !NET9_0_OR_GREATER) || (NETFRAMEWORK) || (NETSTANDARD)
#nullable enable
#pragma warning disable CS9216
// ReSharper disable RedundantUsingDirective
// ReSharper disable CheckNamespace
// ReSharper disable InconsistentNaming
// ReSharper disable PartialTypeWithSinglePart

namespace System.Diagnostics.CodeAnalysis;

// https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.featureguardattribute
[ExcludeFromCodeCoverage]
[AttributeUsage(AttributeTargets.Property, AllowMultiple=true)]
internal class FeatureGuardAttribute(Type featureType) : Attribute
{
public Type FeatureType { get; } = featureType;
}
#endif
21 changes: 21 additions & 0 deletions PolyShim/Net90/FeatureSwitchDefinitionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// The following comment is required to instruct analyzers to skip this file
// <auto-generated/>

#if (NETCOREAPP && !NET9_0_OR_GREATER) || (NETFRAMEWORK) || (NETSTANDARD)
#nullable enable
#pragma warning disable CS9216
// ReSharper disable RedundantUsingDirective
// ReSharper disable CheckNamespace
// ReSharper disable InconsistentNaming
// ReSharper disable PartialTypeWithSinglePart

namespace System.Diagnostics.CodeAnalysis;

// https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.featureswitchdefinitionattribute
[ExcludeFromCodeCoverage]
[AttributeUsage(AttributeTargets.Property)]
internal class FeatureSwitchDefinitionAttribute(string switchName) : Attribute
{
public string SwitchName { get; } = switchName;
}
#endif

0 comments on commit 966037c

Please sign in to comment.