Bug 40250 - "Method not found: 'System.Reactive.Subjects.AsyncSubject`1<!!0> System.Reactive.Linq.Observable.GetAwaiter(System.IObservable`1<!!0>)'." prevents successful build host connection
Summary: "Method not found: 'System.Reactive.Subjects.AsyncSubject`1<!!0> System.React...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: High critical
Target Milestone: 4.1.0 (C7)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-04-08 21:53 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-05-02 13:31 UTC (History)
8 users (show)

Tags: BZSRC6SR3
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 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:
Status:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2016-04-08 21:53:53 UTC
"Method not found: 'System.Reactive.Subjects.AsyncSubject`1<!!0> System.Reactive.Linq.Observable.GetAwaiter(System.IObservable`1<!!0>)'." prevents successful build host connection


This problem is specific to certain environments. According to 1 user report, the issue can be resolved by uninstalling the ReSharper extension from Visual Studio.


Note: I have not yet had a chance to attempt to replicate this problem locally. This bug report is currently based on several existing user reports.  




## Suspected steps to replicate

Attempt to connect to the Mac build host from Visual Studio 2015 Update 2 with the ReSharper extension installed.




## Reported workarounds

1 user has reported that uninstalling the ReSharper extension helped to resolve this issue.




## Results


### Output window

> Starting Broker 4.0.3.214 in port 59949...
> Couldn't connect to MacBuildHost.local. Please try again.
> Disconnected from Mac MacBuildHost.local (192.168.1.52)
> Method not found: 'System.Reactive.Subjects.AsyncSubject`1<!!0> System.Reactive.Linq.Observable.GetAwaiter(System.IObservable`1<!!0>)’.


### Excerpt from *Ide.log file

> Xamarin.Messaging.VisualStudio.MessagingService Information: 0 : [2016-04-06 10:25:34.5979] Starting Broker 4.0.3.214 in port 54433...
> Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Error: 0 : [2016-04-06 10:25:35.9350] Couldn't connect to MacBuildHost.local. Please try again.
> Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Information: 0 : [2016-04-06 10:25:36.0730] MacServer State transition from SshConnectingState to DisconnectedState on MacBuildHost.local (192.168.1.52)
> Xamarin Information: 0 : [2016-04-06 10:25:36.2137] Disconnected from Mac MacBuildHost.local (192.168.1.52)
> Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Error: 0 : [2016-04-06 10:25:36.3442] Method not found: 'System.Reactive.Subjects.AsyncSubject`1<!!0> System.Reactive.Linq.Observable.GetAwaiter(System.IObservable`1<!!0>)'.
> System.MissingMethodException: Method not found: 'System.Reactive.Subjects.AsyncSubject`1<!!0> System.Reactive.Linq.Observable.GetAwaiter(System.IObservable`1<!!0>)'.
>    at System.Net.Mqtt.Client.Client.<ConnectAsync>d__3.MoveNext()
>    at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
>    at System.Net.Mqtt.Client.Client.ConnectAsync(ClientCredentials credentials, Will will, Boolean cleanSession)
>    at Xamarin.Messaging.Client.MessagingConnection.<ConnectAsync>d__18.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
>    at Xamarin.Messaging.Client.Ssh.SshMessagingConnection.<ConnectAsync>d__26.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
>    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
>    at Xamarin.Messaging.VisualStudio.MessagingService.<ConnectAsync>d__70.MoveNext()




## Expected Results

The build host connection succeeds with no exception messages.
Comment 3 napoleon.fr 2016-04-11 08:41:16 UTC
Xamarin VS Plugin is not playing well with OzCode also.

Just solved this issue uninstalling this extension.
Comment 4 Juergen Pichler 2016-04-11 17:50:26 UTC
I can confirm what napoleon.fr@gmail.com said. After deinstalling OzCode everything is working fine.
Comment 5 Omer Raviv 2016-04-12 13:44:25 UTC
Hi, I'm the CTO of OzCode. This conflict can occur whenever you use different Visual Studio extensions that depend on Rx, where one extension relies on the net40 version of Rx and the other relies on the net45 version. When this happens, the first extension that Visual Studio loads "wins" and the other will malfunction. We've reported this issue to Microsoft and we hope they will fix the problem in a future release of Rx.

We're released a version of OzCode that avoids this issue no matter what other extensions you have installed: please get it from this link: http://o.oz-code.com/announcing-ozcode-v2.1-beta
Comment 6 Omer Raviv 2016-04-12 15:28:28 UTC
FWIW I believe this issue is related to this tweet: https://twitter.com/kzu/status/600333293578498048 

It doesn't matter which version of Rx you pick (net40 or net45), there will always be new 3rd party extensions showing up that were compiled against the other :/ 

There are two possible solutions that would protect Xamarin from having this conflict with other extensions altogether: either ILMerge Rx into your assembly, or consume Rx from @sh4na's custom key version ( https://github.com/shana/Rx.NET/commits/custom-key ). I've implemented the latter in OzCode v2.1, and it works very well.
Comment 7 Daniel Cazzulino 2016-04-12 18:10:50 UTC
Hi Omer, 
I'm in the process of automatically providing binding redirects too inside XVS, so it should be fixed very soon too from our side.

I think the right "fix" for other extensions too would either ILMerge as you mention, or to bundle the right version of the assembly. 

In our case, Rx is part of other stacks that aren't XamarinVS-specific, such as the communication protocol with the Mac, which uses MQTT and Reactive, so we can't easily use the alternatives.
Comment 8 xamarin-release-manager 2016-04-12 18:18:47 UTC
Fixed in version 99.0.0.2098 (master)

Author: Jose Gallardo
Commit: b63c22e62688f8a9ccfe0e9f6c54269c2bb0ec49 (xamarin/XamarinVS)
Comment 9 xamarin-release-manager 2016-04-12 18:20:14 UTC
Fixed in version 4.1.0.361 (cycle7)

Author: Jose Gallardo
Commit: 2778f05fadc5fbc9308e5ca656c7cf68893a5df3 (xamarin/XamarinVS)