Commit cf9d325
[AndroidSdkWindows] Guard against exception checking registry (#79)
Fixes: https://developercommunity.visualstudio.com/content/problem/883179/ilegal-characters-in-path-after-fresh-install.html
Somehow, a registry key contains invalid path characters.
This causes an `ArgumentException` from
`AndroidSdkWindows.CheckRegistryKeyForExecutable()`:
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Xamarin.Android.Tools.AndroidSdkWindows.CheckRegistryKeyForExecutable(UIntPtr key, String subkey, String valueName, Wow64 wow64, String subdir, String exe)
at Xamarin.Android.Tools.AndroidSdkWindows.<GetAllAvailableAndroidSdks>d__37.MoveNext()
at System.Linq.Enumerable.<DistinctIterator>d__64`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Xamarin.Android.Tools.AndroidSdkBase.get_AllAndroidSdks()
at Xamarin.Android.Tools.AndroidSdkBase.Initialize(String androidSdkPath, String androidNdkPath, String javaSdkPath)
at Xamarin.Android.Tools.AndroidSdkWindows.Initialize(String androidSdkPath, String androidNdkPath, String javaSdkPath)
at Xamarin.Android.Tools.AndroidSdkInfo..ctor(Action`2 logger, String androidSdkPath, String androidNdkPath, String javaSdkPath)
Handle the `ArgumentException` by wrapping the body of
`CheckRegistryKeyForExecutable()` within a `try/catch` block and
catch all exceptions. If an exception is thrown, there is no
executable of interest.1 parent 310c5cf commit cf9d325
File tree
1 file changed
+12
-8
lines changed- src/Xamarin.Android.Tools.AndroidSdk/Sdks
1 file changed
+12
-8
lines changedLines changed: 12 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
| 306 | + | |
| 307 | + | |
307 | 308 | | |
308 | | - | |
| 309 | + | |
309 | 310 | | |
310 | | - | |
311 | | - | |
312 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
313 | 314 | | |
314 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
315 | 321 | | |
316 | 322 | | |
317 | | - | |
318 | | - | |
319 | 323 | | |
320 | 324 | | |
321 | 325 | | |
| |||
0 commit comments