Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using init-only setter for netstandard #450

Merged
merged 7 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public ConfigurationFeatureDefinitionProvider(IConfiguration configuration)
/// <summary>
/// The option that controls the behavior when "FeatureManagement" section in the configuration is missing.
/// </summary>
public bool RootConfigurationFallbackEnabled { get; init; }
public bool RootConfigurationFallbackEnabled { get; set; }

/// <summary>
/// The logger for the configuration feature definition provider.
/// </summary>
public ILogger Logger { get; init; }
public ILogger Logger { get; set; }

/// <summary>
/// Disposes the change subscription of the configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public TimeWindowFilter(ILoggerFactory loggerFactory = null)
/// <summary>
/// The application memory cache to store the start time of the closest active time window. By caching this time, the time window can minimize redundant computations when evaluating recurrence.
/// </summary>
public IMemoryCache Cache { get; init; }
public IMemoryCache Cache { get; set; }

/// <summary>
/// This property allows the time window filter in our test suite to use simulated time.
/// </summary>
internal ISystemClock SystemClock { get; init; }
internal ISystemClock SystemClock { get; set; }

/// <summary>
/// Binds configuration representing filter parameters to <see cref="TimeWindowFilterSettings"/>.
Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.FeatureManagement/FeatureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public sealed class FeatureManager : IFeatureManager
private readonly TimeSpan ParametersCacheAbsoluteExpirationRelativeToNow = TimeSpan.FromDays(1);

private readonly IFeatureDefinitionProvider _featureDefinitionProvider;
private readonly IEnumerable<IFeatureFilterMetadata> _featureFilters;
private readonly IEnumerable<ISessionManager> _sessionManagers;
private readonly ConcurrentDictionary<string, IFeatureFilterMetadata> _filterMetadataCache;
private readonly ConcurrentDictionary<string, ContextualFeatureFilterEvaluator> _contextualFeatureFilterCache;
private readonly FeatureManagementOptions _options;
private IEnumerable<IFeatureFilterMetadata> _featureFilters;
private IEnumerable<ISessionManager> _sessionManagers;

private class ConfigurationCacheItem
{
Expand Down Expand Up @@ -60,7 +60,7 @@ public IEnumerable<IFeatureFilterMetadata> FeatureFilters
{
get => _featureFilters;

init
set
{
_featureFilters = value ?? throw new ArgumentNullException(nameof(value));
}
Expand All @@ -74,7 +74,7 @@ public IEnumerable<ISessionManager> SessionManagers
{
get => _sessionManagers;

init
set
{
_sessionManagers = value ?? throw new ArgumentNullException(nameof(value));
}
Expand All @@ -83,12 +83,12 @@ public IEnumerable<ISessionManager> SessionManagers
/// <summary>
/// The application memory cache to store feature filter settings.
/// </summary>
public IMemoryCache Cache { get; init; }
public IMemoryCache Cache { get; set; }

/// <summary>
/// The logger for the feature manager.
/// </summary>
public ILogger Logger { get; init; }
public ILogger Logger { get; set; }

/// <summary>
/// Checks whether a given feature is enabled.
Expand Down
21 changes: 0 additions & 21 deletions src/Microsoft.FeatureManagement/IsExternalInit.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>..\..\build\Microsoft.FeatureManagement.snk</AssemblyOriginatorKeyFile>
<LangVersion>9.0</LangVersion>
<!-- Microsoft.FeatureManagement uses the feature of async streams which is not supported in versions of C# earlier than 8.0. -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention why we don't use later than version 8.0

<LangVersion>8.0</LangVersion>
zhiyuanliang-ms marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<PropertyGroup>
Expand Down