-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove indexer from ref source of WebHeaderCollection #37949
Remove indexer from ref source of WebHeaderCollection #37949
Conversation
Tagging subscribers to this area: @dotnet/ncl |
Doesn't this break applications by removing a public API? I'm not sure this is the right fix to the documentation problem. Have you tried writing a .NET Core application and trying to use the string indexer as well as the int indexer? Does the string indexer fail in some way in an application? |
I think it's actually ok. It's definitely a strange situation, but it's not a source breaking change because recompiling will just bind to the base method of the same signature, and if it were going to be a binary breaking change, it'd already be breaking, because the newslot method doesn't exist in the actual implementation. The base type has the same method name, and the C# compiler emits calls to this in a way where the runtime will end up just calling the base method, even though this has a new slot, e.g. via:
or
depending on the access pattern. @terrajobst and @davidwrighton to correct me if I'm wrong. |
I agree with @stephentoub's analysis. I would describe this as an odd way to fix a documentation bug, but a good way to make the reference assemblies more closely resemble what they support. |
It seems we don't have any mechanism to prevent inconsistency in the future as the ref assemblies are maintained manually. However it looks like it shouldn't be a big issue to write a tool to validate/autogenerate the code/assembly to prevent such inconsistency. Do you know why there is no such tool in place? I think it definitely worth to simplify the process of maintaining any part of code. |
@davidsh, it seems the documentation stubs are generated from the ref assemblies. So I don't consider it as fixing the documentation, but the documentation point to ref assembly problem (inconsistency with our code base in this case). Question is if the fix is correct otherwise I suppose wee need to add this indexer to the implementation code base. |
We do; there's tooling that issues warnings/errors on such inconsistencies. For some reason this particular difference doesn't trigger it (probably related to the fact that you can use the method successfully because of the base method). |
This is considered a compatible change which is why APICompat doesn’t flag it. |
The indexer is not implemented on WebHeaderCollection.
This fix extra indexer in the documentation: #4268. More details in the following comment: dotnet/dotnet-api-docs#4268 (comment)