Skip to content

Support overriding library version#3125

Open
philon-msft wants to merge 1 commit into
mainfrom
philon/lib-ver
Open

Support overriding library version#3125
philon-msft wants to merge 1 commit into
mainfrom
philon/lib-ver

Conversation

@philon-msft

Copy link
Copy Markdown
Collaborator

Allow customizing the reported library version via a DefaultOptionsProvider. Intended for use by the Microsoft.Azure.StackExchangeRedis extension package because knowing the extension's version is usually more helpful than the SE.Redis version when diagnosing issues customers are having.

This PR also aligns behavior of LibraryName with other ConfigurationOptions properties in terms of defaulting to a value from the current DefaultOptionsProvider.

static StackExchange.Redis.Configuration.DefaultOptionsProvider.ComputerName.get -> string!
static StackExchange.Redis.Configuration.DefaultOptionsProvider.GetProvider(StackExchange.Redis.EndPointCollection! endpoints) -> StackExchange.Redis.Configuration.DefaultOptionsProvider!
static StackExchange.Redis.Configuration.DefaultOptionsProvider.GetProvider(System.Net.EndPoint! endpoint) -> StackExchange.Redis.Configuration.DefaultOptionsProvider!
static StackExchange.Redis.Configuration.DefaultOptionsProvider.LibraryVersion.get -> string!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@mgravell is there any chance this change is "okay"? I really want to change LibraryVersion from a protected static to public virtual, but that means removing this line from the shipped API.

If this is too much of a break, I can either a) leave the static and add a new instance property with a different name, or b) have the extension package set ConfigurationOptions.LibraryVersion directly rather than bubbling it up form its custom DefaultOptionsProvider. But that's a weird divergence from the other options and risks interacting with customers' use of ConfigurationOptions.LibraryVersion

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The problem isn't changing the shipped file - the problem is the MissingMethodException etc at runtime when someone builds against one version and gets given another - this applies doubly for libraries that package SE.Redis such as azure. I think maybe the right thing here is to accept a sucky name for a new member.

@mgravell

Copy link
Copy Markdown
Collaborator

This gets awkward when multiple libraries think they're king. For example, NRedisStack also tries hard to mess with this. We discussed this about a year ago: #2937 - is it perhaps worth us resurrecting that sort of approach, perhaps with better defaults-provider support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants