Skip to content

Document ProductInfoHeaderValue constructors #3274

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

Open
svick opened this issue May 24, 2018 · 2 comments · May be fixed by #7319
Open

Document ProductInfoHeaderValue constructors #3274

svick opened this issue May 24, 2018 · 2 comments · May be fixed by #7319
Labels
area-System.Net doc-enhancement Improve the current content help wanted Good for community contributors to help [up-for-grabs] Pri3 Indicates issues/PRs that are low priority
Milestone

Comments

@svick
Copy link
Contributor

svick commented May 24, 2018

I'm sometimes making HTTP requests to various APIs. Quite often, they require specifying the User-Agent header. To do that with HttpClient, I have to create ProductInfoHeaderValue, e.g.:

ProductInfoHeaderValue value =;
var client = new HttpClient { DefaultRequestHeaders = { UserAgent = { value } } };

My problem is that creating valid ProductInfoHeaderValue is not obvious and the documentation for its constructors does not explain which constructor I should use or what are the requirements for the string parameters.

As an example, if I try new ProductInfoHeaderValue("svick's awesome tool"), it throws "FormatException: The format of value 'svick's awesome tool' is invalid." This doesn't help me figure out what the valid values are, which is why I think documenting this is important.

This article explains the rules for User-Agent values and might be helpful when resolving this issue.

@rpetrusha
Copy link

Thanks for opening this issue, @svick. At a minimum, making this documentation usable requires:

  • Disambiguating the three constructor overloads (they all have identical descriptions!).
  • Defining what a valid string value is.
    We'll add this to be addressed in quarter 3, and also add it to the project for community contributors.

@mairaw mairaw transferred this issue from dotnet/docs Oct 1, 2019
@dotnet-bot dotnet-bot added the untriaged New issue has not been triaged by the area owner label Oct 1, 2019
@mairaw mairaw added area-System.Net doc-enhancement Improve the current content help wanted Good for community contributors to help [up-for-grabs] and removed untriaged New issue has not been triaged by the area owner labels Oct 1, 2019
@mairaw mairaw added this to the Backlog milestone Oct 1, 2019
@mairaw
Copy link
Contributor

mairaw commented Oct 1, 2019

@davidsh is this something you could help with?

@PRMerger13 PRMerger13 added the Pri3 Indicates issues/PRs that are low priority label Nov 11, 2020
wenz added a commit to wenz/dotnet-api-docs that referenced this issue Oct 24, 2021
@wenz wenz linked a pull request Oct 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net doc-enhancement Improve the current content help wanted Good for community contributors to help [up-for-grabs] Pri3 Indicates issues/PRs that are low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants