Bug 26184 - Unified + 64-bit device + Rx => "Disposable has already been assigned"
Summary: Unified + 64-bit device + Rx => "Disposable has already been assigned"
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 8.6.x (services rel)
Assignee: Zoltan Varga
: 26049 ()
Depends on:
Reported: 2015-01-19 22:55 UTC by rozgo
Modified: 2015-02-16 04:39 UTC (History)
11 users (show)

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

Minimal iOS C# Project that Repros bug (302.93 KB, application/zip)
2015-01-19 22:55 UTC, rozgo

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 rozgo 2015-01-19 22:55:49 UTC
Created attachment 9410 [details]
Minimal iOS C# Project that Repros bug

Using Rx on device crashes in 64bit. We use F#, but could also repro with minimal C# iOS project (attached).

The following code crashes on iOS 64bit builds, but not on 32bit.


public override void ViewDidLoad ()
	base.ViewDidLoad ();

	this.subscription = Observable.Interval (TimeSpan.FromSeconds (1)).StartWith (0)
		.Subscribe(f => {
			Console.WriteLine ("tick: {0}", f);


Please ensure your device is connected...
Connected to: rozgo-plus
Launching /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app -monodevelop-port 10000 -connection-mode usb
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/Xamarin.iOS.dll
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/System.Reactive.Interfaces.dll
Thread started: Finalizer #2
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/System.dll
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/System.Core.dll
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/System.Reactive.Core.dll
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/System.Reactive.Linq.dll
Loaded assembly: /private/var/mobile/Containers/Bundle/Application/B1D09232-6B5E-4822-BEAB-DE3A72D6E541/MyBugReport.app/.monotouch-64/MyBugReport.exe
2015-01-19 21:42:26.494 MyBugReport[9808:4552293] critical: Stacktrace:

2015-01-19 21:42:26.495 MyBugReport[9808:4552293] critical: 
Native stacktrace:

2015-01-19 21:42:26.562 MyBugReport[9808:4552293] critical: 	0   MyBugReport                         0x00000001008746ec mono_handle_native_sigsegv + 268
2015-01-19 21:42:26.563 MyBugReport[9808:4552293] critical: 	1   MyBugReport                         0x000000010087e514 mono_sigsegv_signal_handler + 316
2015-01-19 21:42:26.563 MyBugReport[9808:4552293] critical: 	2   libsystem_platform.dylib            0x0000000194f5895c _sigtramp + 68
2015-01-19 21:42:26.563 MyBugReport[9808:4552293] critical: 	3   MyBugReport                         0x000000010085d744 get_objref + 100
2015-01-19 21:42:26.564 MyBugReport[9808:4552293] critical: 	4   MyBugReport                         0x000000010085d180 buffer_add_value_full + 2104
2015-01-19 21:42:26.564 MyBugReport[9808:4552293] critical: 	5   MyBugReport                         0x0000000100865494 add_var + 472
2015-01-19 21:42:26.564 MyBugReport[9808:4552293] critical: 	6   MyBugReport                         0x0000000100864b90 frame_commands + 712
2015-01-19 21:42:26.564 MyBugReport[9808:4552293] critical: 	7   MyBugReport                         0x000000010085e9f4 debugger_thread + 1744
2015-01-19 21:42:26.564 MyBugReport[9808:4552293] critical: 	8   MyBugReport                         0x00000001009248ac inner_start_thread + 192
2015-01-19 21:42:26.564 MyBugReport[9808:4552293] critical: 	9   libsystem_pthread.dylib             0x0000000194f5fe80 <redacted> + 164
2015-01-19 21:42:26.565 MyBugReport[9808:4552293] critical: 	10  libsystem_pthread.dylib             0x0000000194f5fddc <redacted> + 0
2015-01-19 21:42:26.565 MyBugReport[9808:4552293] critical: 	11  libsystem_pthread.dylib             0x0000000194f5cfb0 thread_start + 4
2015-01-19 21:42:26.565 MyBugReport[9808:4552293] critical: 
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
Comment 1 rozgo 2015-01-19 23:01:30 UTC
Used different versions of Rx. Portables, .Net 4.0, .Net 4.5 all had same issue.
Comment 2 rozgo 2015-01-19 23:04:31 UTC
Call from another user: 

System.InvalidOperationException: Disposable has already been assigned.
  at System.Reactive.Disposables.SingleAssignmentDisposable.set_Disposable (IDisposable value) [0x00000] in <filename unknown>:0
  at System.Reactive.Producer`1+State[XXXX].Assign (IDisposable s) [0x00000] in <filename unknown>:0
  at System.Reactive.Concurrency.ObserveOn`1[XXXX].Run (IObserver`1 observer, IDisposable cancel, System.Action`1 setSink) [0x00000] in <filename unknown>:0
  at System.Reactive.Producer`1[XXXX].Run (IScheduler _, State x) [0x00000] in <filename unknown>:0
  at at (wrapper unknown) object:gsharedvt_out ()
  at System.Reactive.Concurrency.ScheduledItem`2[System.TimeSpan,System.Reactive.Producer`1+State[XXXX]].InvokeCore () [0x00000] in <filename unknown>:0
  at System.Reactive.Concurrency.ScheduledItem`1[System.TimeSpan].Invoke () [0x00000] in <filename unknown>:0
  at System.Reactive.Concurrency.CurrentThreadScheduler+Trampoline.Run (System.Reactive.Concurrency.SchedulerQueue`1 queue) [0x00000] in <filename unknown>:0
  at System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[State] (State state, TimeSpan dueTime, System.Func`3 action) [0x00000] in <filename unknown>:0
  at at (wrapper unknown) object:gsharedvt_in ()
  at at (wrapper unknown) object:gsharedvt_out ()
  at System.Reactive.Concurrency.LocalScheduler.Schedule[State] (State state, System.Func`3 action) [0x00000] in <filename unknown>:0
  at at (wrapper unknown) object:gsharedvt_in ()
  at System.Reactive.Producer`1[XXXX].SubscribeRaw (IObserver`1 observer, Boolean enableSafeguard) [0x00000] in <filename unknown>:0
  at System.Reactive.Producer`1[XXXX].Subscribe (IObserver`1 observer) [0x00000] in <filename unknown>:0
  at System.ObservableExtensions.Subscribe[XXX] (IObservable`1 source, System.Action`1 onNext) [0x00000] in <filename unknown>:0
  at XXXX+<OnAppearing>c__async0.MoveNext () [0x00417] in ....
Comment 3 Rolf Bjarne Kvinge [MSFT] 2015-01-20 03:37:02 UTC
Zoltan, is this also a dup of #26085?
Comment 5 Zoltan Varga 2015-01-20 11:06:08 UTC
Probably a dup of #26085, the exception is the same, at least there is a smaller test case now.
Comment 6 Zoltan Varga 2015-01-20 23:20:16 UTC
*** Bug 26049 has been marked as a duplicate of this bug. ***
Comment 7 Zoltan Varga 2015-01-20 23:21:24 UTC
Disregard comment #5.
Comment 8 Zoltan Varga 2015-01-21 13:50:51 UTC
Fixed in mono-extensions 45f6aec7a5a408656c08ea67561e7a724c0e0e1d.
Comment 9 Sebastien Pouliot 2015-01-21 17:21:33 UTC
monotouch-8.6.0-branch bumped in 0b36fb80743a190b3c5cc98662da9f958b7ac830 (for service release)
Comment 10 GouriKumari 2015-01-21 18:19:53 UTC
Verified this bug with Xamarin.iOS and Xamarin.iOS

Sample App crashed with Xamarin.iOS
CrashLog: https://gist.github.com/GouriKumari/e520bf3c443d3441ef03
Build Log: https://gist.github.com/GouriKumari/08d59d4e16d21b2972d2

Issue got fixed with Xamarin.iOS, which includes the fix.
Application Output: https://gist.github.com/GouriKumari/6a7786100d3df851d653

I am marking this bug as verified fixed.

Test Env:
Xamarin Studio
Version 5.7.1 (build 47)
Installation UUID: 5ed3a124-4b77-4c6f-beb9-c830fd815e2a
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

Apple Developer Tools
Xcode 6.1 (6602)
Build 6A1052c

Version: (Enterprise Edition)
Hash: 0b36fb8
Comment 11 Kent 2015-01-23 21:26:12 UTC
*** Bug 26049 has been marked as a duplicate of this bug. ***
Comment 12 Nicolas VERINAUD 2015-02-04 08:46:42 UTC
Will this fix reach alpha, beta or stable channel soon ? 

I have to publish an app tomorrow...
Comment 13 Rolf Bjarne Kvinge [MSFT] 2015-02-04 08:54:36 UTC
This fix is in the alpha and beta channels right now.
Comment 14 Nicolas VERINAUD 2015-02-04 10:07:14 UTC
Great, thank you !