I canโt say why it fails for you with GZipOutStream , although I assume that it does something else, but only simple deflate compression. I changed my code to use DeflateStream instead of System.IO.Compression , and then it worked like a charm.
byte[] sIn = UTF8Encoding.UTF8.GetBytes("testing some shit"); MemoryStream rawDataStream = new MemoryStream(); DeflateStream gzipOut = new DeflateStream(rawDataStream, CompressionMode.Compress); gzipOut.Write(sIn, 0, sIn.Length); gzipOut.Close(); byte[] compressed = rawDataStream.ToArray();
Edit
Since it was about using compression for the Windows Phone project, I tried using DeflateStream from SharpCompress , and it works just fine, you just need to change which namespace you use, the classes are the same.
source share