Bug 58066 - Unlike other path selection settings in Visual Studio, "Tools > Options > Xamarin > Android Settings > Android SDK Location" is not an editable text field
Summary: Unlike other path selection settings in Visual Studio, "Tools > Options > Xam...
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.6.0 (15.3)
Hardware: PC Windows
: Low minor
Target Milestone: 15.4
Assignee: Juan Marcelo Tondato
URL:
: 58003 ()
Depends on:
Blocks:
 
Reported: 2017-07-11 01:23 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2017-08-17 12:01 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: No
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:
RESOLVED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2017-07-11 01:23:29 UTC
Unlike other path selection settings in Visual Studio, "Tools > Options > Xamarin > Android Settings > Android SDK Location" is not an editable text field




## Example steps to get a feel for the problem


1. Start with a Windows system that has 2 identical copies of the Android SDK installed at 2 different locations.  For my tests, I used the following 2 locations:

- C:\Program Files (x86)\Android\android-sdk

- C:\Android SDK\android-sdk


2. Create symbolic directory links to the 2 locations.  For example, I used the following 2 commands in a cmd.exe command prompt:

mklink /D C:\android-sdk-1 "C:\Program Files (x86)\Android\android-sdk"

mklink /D C:\android-sdk-2 "C:\Android SDK\android-sdk"


3. Navigate to "Tools > Options > Xamarin > Android Settings > Android SDK Location > Change" in Visual Studio.


4. Select either "C:\android-sdk-1" or "C:\android-sdk-2" in the dialog.




## Result 1 (not a problem): The Windows file browser dialog automatically resolves the symlink paths

The "Android SDK Location" UI label gets updated to show the _resolved target path_ rather than the symlink path.

For example, when I select "C:\android-sdk-1" at step 4, the settings page updates to show:
> C:\Program Files (x86)\Android\android-sdk
And if I select "C:\android-sdk-2" at step 4, the settings page updates to show:
> C:\Android SDK\android-sdk
(As expected based on these UI results, the registry values that get saved under the "AndroidSdkDirectory" registry key are also the target paths rather than the symlink paths.)

This symlink resolution is _not_ the problem.  The Windows OS file browsing dialogs themselves are responsible for this behavior, so getting back a resolved target path is the _correct_ result when using these dialogs.




## Result 2 (problematic): The "Android SDK Location" UI field is not an editable text field

The problem is that the "Android SDK Location" UI field is different compared to other Visual Studio path selection settings because it is just printed text rather than an _editable_ text field.  This means that there is no way for the user to edit the selected path to "C:\android-sdk-1" if they really want to (other than editing the registry key in regedit).

Here are 5 examples of settings under "Tools > Options" where the graphical file browser dialog resolves the symlinks but where the path is also editable as a _text field_ so that users could enter a non-resolved symlink path by hand if they wanted to:

- "IntelliTrace > Advanced > Store IntelliTrace recordings in this directory"

- "Web Performance Test Tools > Test Execution > Web application root directory"

- "NuGet Package Manager > Package Sources > Source"

- "Projects and Solutions > Locations" (all 3 location settings)

- "Environment > Import and Export Settings > Automatically save my settings to this file"




## Testing environment info (brief)

XamarinVS 4.6.0.240 (60c3d0e)

Microsoft Visual Studio Enterprise 2017 Preview (Pre)
Version 15.3.0 Preview 3.0
VisualStudio.15.Preview/15.3.0-pre.3.0+26621.2
Microsoft .NET Framework
Version 4.7.02046

Windows 10 Version 1703 (OS Build 15063.413)
US English locale, US Eastern time zone
Logged in with a local user named "Windows User"
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2017-07-11 01:37:29 UTC
## Possible workaround

Create a directory junction rather than a directory symbolic link.  For example, the file browser allowed me to select "C:\android-sdk-3" _without_ any automatic resolving to the target path when I used a directory junction:

mklink /J C:\android-sdk-3 "C:\Program Files (x86)\Android\android-sdk"
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2017-07-11 01:43:01 UTC
*** Bug 58003 has been marked as a duplicate of this bug. ***
Comment 3 xamarin-release-manager 2017-08-14 18:11:19 UTC
Fixed in version 4.7.0.898 (d15-4)

Pull Request #7950 merged by: Jose Gallardo
Author: tondat
Commit: 6b2763b3ed7789dc9403a69b7d828140bd43808f (xamarin/XamarinVS)
Comment 4 Prashant [MSFT] 2017-08-17 12:01:04 UTC
I have verified the fix on following build.

Microsoft Visual Studio Enterprise 2017 
Version 15.3.0
VisualStudio.15.Release/15.3.0+26730.3
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Enterprise

Xamarin   4.7.0.896 (6b2763b3e)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.4.0.19 (0cd0214)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.12.0.14 (bf350ba)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

The SDK path are editable now http://i.imgur.com/a7x99F8.png