Bug 56651 - SshClient.Connect can hang on older OS's
Summary: SshClient.Connect can hang on older OS's
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: XMA ()
Version: unspecified
Hardware: PC Windows
: High major
Target Milestone: 15.3
Assignee: Bugzilla
: 56573 56792 ()
Depends on:
Reported: 2017-05-18 23:31 UTC by reemfz
Modified: 2017-06-13 21:21 UTC (History)
14 users (show)

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

previewer error message which makes no sense. (229.85 KB, image/png)
2017-05-18 23:31 UTC, reemfz

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:

Description reemfz 2017-05-18 23:31:43 UTC
Created attachment 22295 [details]
previewer error message which makes no sense.


I downloaded a Forms project from Xamarin University.
Initially the project built and ran fine but after adding a new XAML file, it no longer built. The reason was incompatibility with the Forms DLL version. I went ahead and upgraded the nuget packages to the latest Forms and everything worked.

However, as soon as I tried launching the Previewer, I got an error message saying that the installed Forms version is older than the minimum required for the Previewer to work. (see attachment)
I double checked again and my installed version is newer than the required version.

To make matter worse, Visual Studio performance got so bad, to a point were Visual Studio prompted me to KILL Xamarin.Forms extension. This ridiculous performance degradation ONLY happens if I launch the Previewer. To get everything back to normal, I had to restart VS.

Xamarin University project downloaded from XAM130 Exercise 1 in case you want to try it out.

System info:

Windows 7 64bit
Microsoft Visual Studio Professional 2017 
Version 15.2 (26430.6) Release
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Professional

Visual Basic 2017   00370-10000-70240-AA842
Microsoft Visual Basic 2017

Visual C# 2017   00370-10000-70240-AA842
Microsoft Visual C# 2017

Visual C++ 2017   00370-10000-70240-AA842
Microsoft Visual C++ 2017

Visual F# 4.1   00370-10000-70240-AA842
Microsoft Visual F# 4.1

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

CreateLayoutWizard   1.0
Create layout wizard.

DevExpress.DeploymentTool   1.0
A useful tool for deploying DevExpress assemblies.

JavaScript Language Service   2.0
JavaScript Language Service

JetBrains ReSharper Ultimate 2017.1.2    Build 108.0.20170428.75743
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Visual Studio tools for CMake   1.0
Visual Studio tools for CMake

Xamarin (c871575)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK (448f54f)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK (30b6e87)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 1 xamarin-release-manager 2017-05-23 22:04:01 UTC
Fixed in version (master)

Author: Alan McGovern
Commit: b99053dfec7df7718b32137e516da0c19c04ac20 (xamarin/md-addins)
Included in Commit: ce04c4dddd1cddaf5afaf0372bb6007e4ceab1d6 (xamarin/XamarinVS)
Comment 2 Alan McGovern 2017-05-24 12:11:01 UTC
*** Bug 56792 has been marked as a duplicate of this bug. ***
Comment 3 Alan McGovern 2017-05-24 13:05:13 UTC
I'm just going to re-open this issue as there is some new information that we would like to get!

It looks like our QA can reproduce the performance issue, but only on Windows 7 machines. Stanley, can you confirm the version of windows you are using? reemfz is on Windows 7 which does match our current thinking.

Secondly: The hang we were able to reproduce under windows 7 seems to happen before the previewer is loaded/initialized. Could one (or both) of you record a screencast showing the issue you're experiencing? It might help us figure out what's going on. This is what we're seeing at the moment: https://www.screencast.com/t/98hRFHPRFQ2
Comment 4 Alan McGovern 2017-05-24 13:13:37 UTC
*** Bug 56573 has been marked as a duplicate of this bug. ***
Comment 5 Alan McGovern 2017-05-24 13:16:32 UTC
We have a second screencast which triggers the same issue while opening the previewer toolwindow. https://www.screencast.com/t/yewlPjFpiA

I wonder if the UI thread is being blocked by another operation in the IDE, thus causing this to happen.

If neither of these two screencasts matches the hang you all are seeing, please let us know exactly what is hanging for you.
Comment 6 linwen 2017-05-24 14:15:35 UTC
Hello All
    If your xamarin mac agent has inactive IP, try to ignore it, good luck.
Comment 7 Alan McGovern 2017-05-24 14:24:14 UTC
We have a stacktrace pinpointing the issue as network calls being executed on the main thread:


We should review the XMA code to ensure it runs all blocking network operations on a background thread. The stacktrace shows one cause, but there could be more.
Comment 8 Alan McGovern 2017-05-24 15:03:24 UTC
For people affected by this issue: The simplest workaround for now is to open the Mac Agent selection dialog and forget all paired machines (so the IDE never tries to automatically connect to one), or to ensure that the Mac you paired to is connectable. The hang should only occur for the case where there *is* a paired Mac *and* that Mac is not reachable.
Comment 9 reemfz 2017-05-24 16:28:12 UTC

thank you for looking into this.
After watching both screen casts, the second one is exactly the behavior I was seeing on my machine. 
I will try Alan's workaround and see how that works.

with regards to the first issue where the previewer refuses to load due to versioning issue, should I open a new ticket for that?

Comment 10 Alan McGovern 2017-05-24 16:59:12 UTC
I believe the issue with xamarin.forms being considered too old should be fixed in newer builds. If the issue recurs with the next 15.3 preview release, or any of the alpha/beta releases for our next major release, do file a bug!
Comment 11 reemfz 2017-05-24 18:07:52 UTC
okay thank you.
I'll keep that in mind.
Comment 12 xamarin-release-manager 2017-06-13 21:18:39 UTC
Fixed in version (master)

Author: Mauro Agnoletti
Commit: 80d28505bd2f836ad25d350bb5db5040cd2dbfa4 (xamarin/XamarinVS)
Comment 13 mag@xamarin.com 2017-06-13 21:21:29 UTC
A hotfix has been added to fix this in 15.3, however for 15.4 this will be fixed by design given that the hole communication layer for Xamarin VS (including SSH) has been re designed in order to decouple it from iOS.

By now, the hotfix consists of running the SSH connection (as part of the validation when executing an SSH command), in a background thread in order to not hang the caller if it comes from the UI thread.