Bug 1115 - DeflateStream doesn't work.
Summary: DeflateStream doesn't work.
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 1.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-09-28 17:35 UTC by Jonathan Pryor
Modified: 2011-10-06 05:59 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jonathan Pryor 2011-09-28 17:35:08 UTC
Try the following test:

  void TestDeflate ()
    const string expected = "Hello, compressed world!";
    var o = new MemoryStream ();

    using (var deflate = new StreamWriter (
          new DeflateStream (o, CompressionMode.Compress)))
      deflate.WriteLine (expected);

    o = new MemoryStream (o.ToArray ());
    o.Position = 0;
    Log.Debug ("HelloApp", "deflate compressed data: {0}",
        string.Join (" ", o.ToArray ().Select (b => b.ToString ("x2"))));

    string result;
    using (var deflate = new StreamReader (
          new DeflateStream (o, CompressionMode.Decompress)))
      result = deflate.ReadLine ();

    if (result != expected)
      throw new InvalidOperationException ("Deflate test failed! Got '" +
          result + "'; expected '" + expected + "'.");

It fails:

E/mono    (16039): Unhandled Exception: System.InvalidOperationException: Deflate test failed! Got ''; expected 'Hello, compressed world!'.
E/mono    (16039):   at Mono.Samples.Hello.HelloActivity.TestDeflate () [0x00000] in <filename unknown>:0 
E/mono    (16039):   at Mono.Samples.Hello.HelloActivity.OnCreate (Android.OS.Bundle bundle) [0x00000] in <filename unknown>:0 
E/mono    (16039):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00000] in <filename unknown>:0 
E/mono    (16039):   at (wrapper dynamic-method) object:3711826d-41cc-4fcc-b090-035cc6e0e230 (intptr,intptr,intptr)

See also: http://lists.ximian.com/pipermail/monodroid/2011-September/006293.html
Comment 1 Atsushi Eno 2011-10-06 05:59:23 UTC