Hi there. I have just migrated from version 4.5.8 to 4.5.14.
I’ve noticed (from broken tests) a breaking change in an endpoint that we serve images from.
I think the bytes coming back from it are somehow different than they used to be in v 4.5.8.
My service looks like this:
[AddHeader(ContentType = MimeTypes.ImagePng)]
public Stream Get(GetPngPic body)
...serve up an image stream from storage
On the client I am doing this:
var bytes = "https://localhost/api/images/1234.png".GetBytesFromUrl();
var stream = new MemoryStream(bytes);
var image = (Bitmap)Image.FromStream(stream);
that last line is throwing an exception now: System.ArgumentException: Parameter is not valid.
Has anything changed between 4.5.8 and 4.5.14 that would affect this?
It’s impossible to tell what change made between v4.5.8 released on 2017-03-29 and 4.5.14 released 2017-09-06 is the cause for some random Exception. There’s even less chance to identify it without its full StackTrace showing what’s throwing the Exception.
Like any issues, check to see if it’s been resolved with the latest version, if it’s still an issue, include a stand-alone repro I can run locally to repro the issue and I’ll investigate and identify what the issue is.
I thought the difference would be in ServiceStack.Text between 5.0.0 and 5.0.2, since GetBytesFromUrl() is in HttpUtils which is in ServiceStack.Text.
But not seeing much change there that could be related, except the addition to PclExport stuff.
If I add this test to the mix, that uses HttpClient I think I can conclude that the problem is not in the client, but in the server code? correct?
public async Task WhenGetPicWithHttpClient_ThenReturnsPic()
var url = _baseUrl
var client = new HttpClient();
var stream = await client.GetStreamAsync(url);
//BUG: When version 4.5.14
//BUG: This line throws: System.ArgumentException: Parameter is not valid.
var image = (Bitmap) Image.FromStream(stream);
Is there any chance your team would do a 4.5.15 fix to include this fix.
To support those that
(a) may have this bug, but don’t know it yet (i.e. they had no tests to detect it yet, and have code out in the wild with this introduced bug),
(b) stuck on 4.X and cant go to 5.X yet, because of size of migration work?