Skip to content

[Configuration] WritableOptions depends on IOptionsMonitor<T> although only IOptionsSnapshot<T> functionality is used #3006

Open

Description

@DevTKSS

What would you like to be changed

Replace the dependency on IOptionsMonitor<T> with IOptionsSnapshot<T>:

  • Change the constructor dependency and internal field type in WritableOptions<T>
  • Update WritableOptions.Value to use _options.Value instead of _options.CurrentValue
  • Adjust the service registration in ConfigureAsWritable<T> accordingly
    (currently the only registration site; VS Code navigation already points to this class)

Why is this needed

WritableOptions<T> currently depends on IOptionsMonitor<T>, although it does not provide any monitor-specific functionality such as OnChange event and neither uses them internally.

The implementation only uses functionality that is already provided by IOptionsSnapshot<T>:

  • .Get(name)
  • CurrentValue which is equivalent to IOptionsSnapshot<T>.Value

This is also reflected in the public API:

Reducing the dependency to IOptionsSnapshot<T> would:

  • better align implementation with the exposed interface
  • avoid unnecessary higher-privilege options access
  • simplify the mental model for consumers

For which platform

  • All platforms

Anything else we need to know?

Activity

  1. added
    kind/enhancement
    triage/untriaged
    on Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementtriage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions