What happened?
Calling IConnection.GetRaw() for an endpoint that responds with non-binary content (e.g. application/json) results in a NullReferenceException being thrown when updating to Octokit 8.0.1.
This appears to be due to the changes in #2782 to handle large binary responses.
In the case where the response is not a Stream but instead is just a string, response.Body as Stream returns null, and then causes an exception here:
|
await stream.CopyToAsync(ms); |
Fix incoming shortly, but a workaround is to use IConnection.GetRawStream() and refactor calling code to deal with Stream instead of byte[].
Versions
8.0.1
Relevant log output
System.NullReferenceException: Object reference not set to an instance of an object.
at Octokit.Connection.StreamToByteArray(Stream stream) in /_/Octokit/Http/Connection.cs:line 724
at Octokit.Connection.GetRaw(IRequest request) in /_/Octokit/Http/Connection.cs:line 704
at MartinCostello.Costellobot.Pages.DeliveryModel.OnGet(Int64 id) in /_/src/Costellobot/Pages/Webhooks/Delivery.cshtml.cs:line 64
Code of Conduct
What happened?
Calling
IConnection.GetRaw()for an endpoint that responds with non-binary content (e.g.application/json) results in aNullReferenceExceptionbeing thrown when updating to Octokit 8.0.1.This appears to be due to the changes in #2782 to handle large binary responses.
In the case where the response is not a
Streambut instead is just astring,response.Body as Streamreturnsnull, and then causes an exception here:octokit.net/Octokit/Http/Connection.cs
Line 724 in 0238092
Fix incoming shortly, but a workaround is to use
IConnection.GetRawStream()and refactor calling code to deal withStreaminstead ofbyte[].Versions
8.0.1
Relevant log output
Code of Conduct