Bug 32140 - The object was used after being disposed when canceling a task that is making a network call
Summary: The object was used after being disposed when canceling a task that is making...
Status: RESOLVED DUPLICATE of bug 31507
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: XI 8.10
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-20 09:27 UTC by John Miller [MSFT]
Modified: 2015-07-21 07:34 UTC (History)
4 users (show)

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


Attachments

Description John Miller [MSFT] 2015-07-20 09:27:14 UTC
**Overview:**

   When canceling a running Task that is doing a network call, an exception is thrown: The object was used after being disposed.

**Steps to Reproduce:**

   1. Run the attached sample on an iPhone Simulator
   2. Press the only Button multiple times, quickly.

**Actual Results:**

    System.ObjectDisposedException: The object was used after being disposed.
  at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) [0x0002c] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.3.2/src/mono/mcs/class/System/System.Net/WebConnection.cs:1071 
  at System.Net.WebConnectionStream.WriteAsyncCB (IAsyncResult r) [0x00013] in //Library/Frameworks/Xamarin.iOS.framework/Versions/8.10.3.2/src/mono/mcs/class/System/System.Net/WebConnectionStream.cs:458 

   Full stacktrace here: https://gist.github.com/therealjohn/e8128aef9ea9444e3836

**Expected Results:**

   No exceptions and the task is cancelled.

**Build Date & Platform:**

   === Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Xamarin.Android ===

Version: 5.1.4.16 (Business Edition)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

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

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.3.2 (Business Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Mac ===

Version: 2.0.2.35 (Business Edition)

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.2

**Additional Information:**

   I tried to replicate this in a simpler console app (included in the soluton as "ConsoleTest"), but it was not successful so I included the iOS app. 
   Also stems from this: http://stackoverflow.com/questions/31020937/cancelling-a-task-results-in-objectdisposedexception
Comment 2 Marek Safar 2015-07-21 07:34:21 UTC

*** This bug has been marked as a duplicate of bug 31507 ***

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