-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
IRequest.Headers uses copy semantics instead of reference semantics #2671
Comments
http://cefsharp.github.io/api/71.0.0/html/P_CefSharp_IRequest_Headers.htm For anyone else reading this, I'll point out that this is the current expected behaviour.
It's this expectation that makes is so hard to map/wrap. Exposing the If someone wants to submit a It maybe possible to improve the user experience by throwing an exception if you modify the collection and don't call the additionally required If anyone has other ideas, including how to better document the current behaviour then I'm open to suggestions. |
Ok, first of all, I haven't read the documentation of the property 🤦♂️ Introducing any breaking change is not worth the effort IMO. Another solution could be to write a code analyzer rule for these cases, which provides a warning, if the user doesn't set the property after getting. I'm not sure, how much effort would that take. It might be the easiest to assume, that the user just reads the documentation. |
It isn't the best documentation I've ever written, at a minimum let's add a code example. For my own reference https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/example |
I've added a xml doc code example in f77c6d2 There's also now |
What version of the product are you using?
CefSharp.Common 71.0.0
from NuGetWhat architecture x86 or x64?
On what operating system?
I am using
WPF
What steps will reproduce the problem?
DefaultRequestHandler
OnBeforeResourceLoad
What is the expected output? What do you see instead?
"Authorization"
header is set inrequest.Headers
request.Headers
is unchangedPlease provide any additional information below.
request.Headers = headers;
, the Expected outcome will happen.Headers
getter and setter has copy semantics. This is unexpected in C#, as classes use reference semantics, so one would expect, that the code above will just work.Does this problem also occur in the
CEF
Sample Application from http://opensource.spotify.com/cefbuilds/index.html?The text was updated successfully, but these errors were encountered: