Bug 34139 - GZipStream (DeflateStreamNative) native exception after Flush() with no buffer data: Internal error (no progress possible) Flush
Summary: GZipStream (DeflateStreamNative) native exception after Flush() with no buffe...
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: 5.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 6.0 (C6)
Assignee: Marek Habersack
Depends on:
Reported: 2015-09-21 18:00 UTC by Jon Goldberger [MSFT]
Modified: 2015-11-13 16:25 UTC (History)
2 users (show)

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

Test Project (36.15 KB, application/zip)
2015-09-21 18:00 UTC, Jon Goldberger [MSFT]

Description Jon Goldberger [MSFT] 2015-09-21 18:00:37 UTC
Created attachment 13002 [details]
Test Project

## Description

This is a Mono bug that has been fixed in Mono but does not seem to be in XA yet.

Mono bug report: bug #28777

I have attached a solution that has a Console project and an Android project. The test code from bug #28777 runs without exception in the Console project but throws in the XA project. Stack trace:

>Java.Lang.RuntimeException: java.lang.reflect.InvocationTargetException
>  at --- End of managed exception stack trace ---
>  at java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
>  at Caused by: java.lang.reflect.InvocationTargetException
>  at at java.lang.reflect.Method.invoke(Native Method)
>  at at java.lang.reflect.Method.invoke(Method.java:372)
>  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
>  at ... 1 more
>  at Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.IO.IOException: Internal error Flush
>  at System.IO.Compression.DeflateStreamNative.CheckResult (int,string) [0x000a5] in /Users/builder/data/lanes/2058/58099c53/source/mono/mcs/class/System/System.IO.Compression/DeflateStream.cs:475
>  at System.IO.Compression.DeflateStreamNative.Flush () [0x0000c] in /Users/builder/data/lanes/2058/58099c53/source/mono/mcs/class/System/System.IO.Compression/DeflateStream.cs:367
>  at System.IO.Compression.DeflateStream.Flush () [0x00027] in /Users/builder/data/lanes/2058/58099c53/source/mono/mcs/class/System/System.IO.Compression/DeflateStream.cs:183
>  at System.IO.Compression.GZipStream.Flush () [0x0001c] in /Users/builder/data/lanes/2058/58099c53/source/mono/mcs/class/System/System.IO.Compression/GZipStream.cs:95
>  at TestGzipStream.Droid.MainActivity.OnCreate (Android.OS.Bundle) [0x00067] in /Users/apple/Downloads/TestGzipStream/TestGzipStream.Droid/MainActivity.cs:41
>  at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/2058/58099c53/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2475
>  at at (wrapper dynamic-method) object.47de0bfd-377e-49af-acfc-a44167a3fa8d (intptr,intptr,intptr) <IL 0x00017, 0x00027>
>  at at md598269549f3660137f48355e244411308.MainActivity.n_onCreate(Native Method)
>  at at md598269549f3660137f48355e244411308.MainActivity.onCreate(MainActivity.java:28)
>  at at android.app.Activity.performCreate(Activity.java:5990)
>  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
>  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
>  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
>  at at android.app.ActivityThread.access$800(ActivityThread.java:151)
>  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
>  at at android.os.Handler.dispatchMessage(Handler.java:102)
>  at at android.os.Looper.loop(Looper.java:135)
>  at at android.app.ActivityThread.main(ActivityThread.java:5254)
>  at ... 4 more

## Steps to reproduce

1. Open the attached test project and launch the Android project to device/simulator (Tested with XAP Nexus 5 Lollipop simulator)

Expected result: App will launch without exception.

Actual result: app crashes with exception noted above.

## Notes

I also tested with the Alpha build XA and got the same results. This does not seem to be a regression. 

## My environment

=== Xamarin Studio ===

Version 5.9.7 (build 9)
Installation UUID: 964c531b-d928-456b-a9ae-e1f82266b360
	Mono 4.0.4 ((detached/cb6d6b2)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040002

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 509070009
Git revision: 31fa64709030b3edb971237780a452a4c69943c4
Build date: 2015-09-17 11:44:37-04
Xamarin addins: b105d33d8cd72911ff2cf3ee0b7715d37e5f19a6

=== Operating System ===

Mac OS X 10.10.5
Darwin Jons-iMac.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 2 Peter Collins 2015-09-30 16:55:28 UTC
The attached test is no longer throwing when compiled against master/b1574104.

Note You need to log in before you can comment on or make changes to this bug.