You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm trying to send request from Unity using RestSharp 110.2.0 - sending normal request works but when I make multipart request with attachment it sends requests and then immediately throws NullReferenceException from System.Net.Http.MultipartContent.Dispose. I tried attaching file using stream creating callback and file name with same results. This is an attempt to send discord webhook request with attachment and message actually appears on the server despite NRE after sending.
To Reproduce
Sending request with this code succeeds but throws exception:
After debugging with dnspy I can see what's happening - it seems like RequestContent tries to dispose its content after it has been disposed already by HttpClient which I think it does after sending request. When disposing MultipartContent it does this (decompiled):
So second call to that function would throw NRE while trying to enumerate nested_content. This is probably a bug in the System.Net.Http because Dispose is supposed to be safe to be called twice but that's not something I can replace. Can probably be worked around by not calling dispose on request content that has been disposed by HttpClient on .NET versions where bug is present if that is possible. This seems to have been fixed in reference source by replacing = null with .Clear() but that bug is still in version used by latest Unity.
Describe the bug
I'm trying to send request from Unity using RestSharp 110.2.0 - sending normal request works but when I make multipart request with attachment it sends requests and then immediately throws NullReferenceException from
System.Net.Http.MultipartContent.Dispose
. I tried attaching file using stream creating callback and file name with same results. This is an attempt to send discord webhook request with attachment and message actually appears on the server despite NRE after sending.To Reproduce
Sending request with this code succeeds but throws exception:
Expected behavior
Function successfully returning response after request has been sent.
Stack trace
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: