dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.03k stars 4.67k forks source link

Compability of GZipStream between core and framework #24048

Closed Fedorus closed 4 years ago

Fedorus commented 6 years ago

Ive tried to port popular library for http requests called xNet and faced interesing issue. Library compiled for standart 2.0 works fine when its used in Windows Console project and falls with errow when used in Core Console Project (both test projects in my repo). Problem appiers when you try to download http content coded with gzip. Problem located to this line: https://github.com/Fedorus/xNetStandart/blob/master/~Http/HttpResponse.cs#L1487 int bytesRead = stream.Read(buffer, 0, bufferSize); where int bufferSize = ~65k buffer = new byte[bufferSize] and real stream content is less.

On such circumstances code will fail becouse stream will wait for data. Ive tried fixing it but failed. Looks like there is something deeper but I havent located it yet.

There is original repo of xNet and my modified version with 2 test projects (windows and core console) origin: https://github.com/X-rus/xNet ported: https://github.com/Fedorus/xNetStandart

Thanks for atention. I hope someone will point me in my mistake or helps solving this issue.

danmoseley commented 6 years ago

@Fedorus is it possible for you to construct a minimal repro case?

karelz commented 6 years ago

No response, closing. If there is repro available, we can reopen. FYI @ianhays

WorkingRobot commented 5 years ago

I've found a repro case for this issue. Code in .NET Framework: https://dotnetfiddle.net/bdnNCF Code in .NET Core: https://dotnetfiddle.net/K8JH5A The code attached is exactly the same, only the compiler is different.