Bug 35859 - Unable to connect to OS X due to invalid generated ClientId (computer username has non-ascii character)
Summary: Unable to connect to OS X due to invalid generated ClientId (computer usernam...
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS (show other bugs)
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: C6SR0
Assignee: Akhilesh kumar
URL:
Depends on:
Blocks:
 
Reported: 2015-11-14 06:13 UTC by Øystein Krog
Modified: 2015-11-26 10:40 UTC (History)
7 users (show)

Tags: _XVSSR0
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 Øystein Krog 2015-11-14 06:13:36 UTC
It seems you do not take into account that windows username can have special characters (even including single quote!) when you generate the OS X connection ClientID.
Keep in mind that my OS X _username_ does not include special characters (in fact it is just "k").

From the logs:

System.Net.Mqtt.Client.Client Error: 0 : [2015-11-14 12.06.10.3034] System.Net.Mqtt.Exceptions.MqttException: vs6532Øyste is an invalid ClientId. It must contain only numbers and letters
   at System.Net.Mqtt.Formatters.ConnectFormatter.GetPayload(Connect packet)
   at System.Net.Mqtt.Formatters.ConnectFormatter.Write(Connect packet)
   at System.Net.Mqtt.Formatters.Formatter`1.<>c__DisplayClass9.<FormatAsync>b__8()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- 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.Net.Mqtt.Formatters.Formatter`1.<FormatAsync>d__b.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.Net.Mqtt.PacketManager.<GetBytesAsync>d__8.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.Net.Mqtt.PacketChannel.<SendAsync>d__a.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.Net.Mqtt.Client.Client.<>c__DisplayClass30.<<SendPacketAsync>b__2f>d__32.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.Net.Mqtt.Client.Client.<SendPacketAsync>d__35.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.Net.Mqtt.Client.Client.<ConnectAsync>d__3.MoveNext()
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Information: 0 : [2015-11-14 12.06.11.1686] MacServer State transition from SshConnectingState to DisconnectedState on ks-Mac.local (192.168.238.128)
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Error: 0 : [2015-11-14 12.06.11.4022] An error occurred on the underlying client while executing an operation. Details: vs6532Øyste is an invalid ClientId. It must contain only numbers and letters
Xamarin.VisualStudio.IOS.Messaging.State.DisconnectedState Information: 0 : [2015-11-14 12.06.11.5862] Disconnected from Mac ks-Mac.local (192.168.238.128)
Xamarin.VisualStudio.IOS.Messaging.State.ServerStateContext Error: 0 : [2015-11-14 12.06.11.7303] Couldn't connect to ks-Mac.local. Please try again.
co
Comment 2 Akhilesh kumar 2015-11-16 14:08:45 UTC
I am trying to reproduce this issue with C6 build but not able to reproduce this at my end.

I have tried it with following combination of Windows machine and Mac OS X machine name:

1# 
Windows name: ØysteinKrog
Mac name: k

2# 
Windows name: Ø
Mac name: k

3# 
Windows name: '
Mac name: k

4# 
Windows name: ā
Mac name: k

I am successfully able to connect VS with BH and able to build/run iOS application.

Could you please provide the machine name(Windows and Mac) with which I can reproduce this issue at my end?
Comment 3 Øystein Krog 2015-11-16 14:11:04 UTC
My machine name is actually just "desktop". 
I don't actually know _where_ you get my name (Øystein) from, I assumed it was the windows user account.
Comment 5 Akhilesh kumar 2015-11-17 07:27:13 UTC
Sorry for the confusion. "Windows name" and "Mac name" mentioned in comment 2 means "Windows user name" and "Mac user name".

Now I have tried it with Windows user name to "Øystein" and Mac user name to "Apple" and I am successfully able to connect VS with BH without any error.

Screencast: http://screencast.com/t/4FtFMHaXla

Also tried with Windows user name to "Øystein" and Mac user name to "k" and getting same behavior. http://screencast.com/t/oNPt5EZK
Comment 6 Øystein Krog 2015-11-17 07:50:07 UTC
Well I don't know how your code generates the clientId, but somehow it pulls in part of my name, which causes problems.
I don't see any way to change the generated clientid.
What clientId does your repro setup generate (see in logs)?
Comment 8 Adrian Alonso 2015-11-17 08:00:19 UTC
@Øystein Krog: I'm an engineer in the VS team and I was able to reproduce the issue and it's already fixed in our main branch. I will continue the discussion with Akhilesh in private and will back to you with the conclusion. But the fix should be included in the next release. Thanks, Adrian
Comment 12 Saurabh 2015-11-19 04:21:52 UTC
I am also able to reproduce this Issue with stable builds (XVS 4.0.0.1689 and XI 9.2.1.51) when having username non-ascii character. This is the IDE log for the same: https://gist.github.com/saurabh360/5b66318d63f54e4ecc97 and environment details: https://gist.github.com/saurabh360/b4ebbc92c9cd4cde990f

I have checked the same thing with latest master builds (XVS 99.0.0.656 and XI 9.3.2.311). Now VS getting connected successfully.
Xamarin Log: https://gist.github.com/saurabh360/7c61fe9f1ea45b4f1d29
IDE Log: https://gist.github.com/saurabh360/3584aa11ef700779a6c5 
Environment details: https://gist.github.com/saurabh360/83240133f2d689be11d6
Comment 13 Akhilesh kumar 2015-11-19 05:45:15 UTC
Here the key point to reproduce this issue is that **home directory** name should have special character 'Ø' like "Øakhileshk" and we can check it through Command prompt or by home directory folder name(C:\Users\Øakhileshk) of the user.
Comment 14 Akhilesh kumar 2015-11-23 12:32:10 UTC
I have checked this issue with latest C6 SR0 XVS build and I am successfully able to connect VS with mac build host and able to build iOS application successfully. And my user name and home directory name has special character 'Ø', in this case "Øsaurabh".

Screencast: http://www.screencast.com/t/LSbeIyCzmjt

So I am closing this issue.

Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.01055

Xamarin   4.0.0.1695 (8a888b8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.0.0.34 (3efa14c)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.2.1.51 (3c0ec35)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-23 15:36:13 UTC
For reference for any users who might come across this bug report, the tentative plan is to make the C6 SR0 XVS build (mentioned in comment 14) available via the Alpha updater channel as soon as possible this week (the week of November 23).
Comment 16 xamarin-release-manager 2015-11-26 10:40:18 UTC
Fixed in version 4.0.1.1 (cycle6)

Author: Adrian Alonso
Commit: 5d3b2f87f830d2b1ded5549ee69e66ef8ad8188d (xamarin/XamarinVS)