-
Notifications
You must be signed in to change notification settings - Fork 558
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
UnixDomainSocketBinding ignoring set ReaderQuotas #5660
Comments
You could also create a CustomBinding from the binding and add a BinaryMessageEncodingBindingElement copying the reader quotas across. That way you don't need to use reflection or create your own class. |
Thanks for your info, i also had the This also works but it is important to not only add the element because that would result in another exception because the So if the
The |
I would do this in anticipation of a fix: CustomBinding binding = new CustomBinding(udsBinding);
if (binding.Elements.Find<BinaryMessageEncodingBindingElement>() == null)
{
BinaryMessageEncodingBindingElement messageEncodingElement = new BinaryMessageEncodingBindingElement();
udsBinding.ReaderQuotas.CopyTo(messageEncodingElement.ReaderQuotas);
binding.Elements.Insert(0, messageEncodingElement);
} |
@birojnayak, can you take a look. We should have a test which validates the reader quotas get applied. I think the easiest way to test that is to have an api where you send and receive a string. The MaxStringContentLength reader quota limits how long the string can be, the default is 8192. |
Yes, this way it would be also safe when the |
Describe the bug
When using the
UnixDomainSocketBinding
for the WCF Client the setReaderQuotas
are ignored which may lead to an exception:"[...] The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader."
I have set the mentioned
MaxArrayLength
to a higher value which works well onNetNamedPipeBinding
but not onUnixDomainSocketBinding
.To Reproduce
If needed i can try to create a small sample project the next days but i add informations after my investigations in Additional context below.
Expected behavior
The set
ReaderQuotas
of theUnixDomainSocketBinding
to be considered like in other Bindings likeNetNamedPipeBinding
Additional context
After some investigation of this behavior i found that the
NetNamedPipeBinding
add's the createdBinaryMessageEncodingBindingElement
of the_encoding
field whenCreateBindingElements
is called.While the
UnixDomainSocketBinding
does not add theBinaryMessageEncodingBindingElement
of the_encoding
field:As workaround i created my own binding which derives form
UnixDomainSocketBinding
and overrides theCreateBindingElements
.In my override i get the value of
_encoding
via reflection and add it at first position of theBindingElementCollection
(like also done atNetNamedPipeBinding
). With that binding theReaderQuotas
are considered and the Data get read correctly.The text was updated successfully, but these errors were encountered: