Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Due to the underlying inheritance from Cosmos.UserAgentContainer and Documents.UserAgentContainer, the base user agent string only gets re-calculated if the Suffix (ApplicationName) setter is used on the underlying Documents.UserAgentContainer.
Currently we are tracking a set of Features through the user Agent, but since these Features are set during Client creation, cannot be part of the BaseUserAgent. So we set them after, like the Suffix, when building the ConnectionPolicy:
https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs#L748
The problem is that if the user is not setting ApplicationName / Suffix, and using features like Bulk or the new HttpClientFactory, those features do not get added to the UserAgent because the Suffix is not modified.
Calling the Suffix setter with a
string.Empty
forces the base user agent to be recalculated. This does not affect the scenario where the user is indeed setting the ApplicationName because that happens after.Since this only happens on client building, there is no performance impact.
Ideal solution would be to stop inheriting from Documents.UserAgentContainer but that would require a rewiring through the complete stack including files in the Direct package.
Type of change
Please delete options that are not relevant.