Skip to content

Conversation

@emaf
Copy link
Contributor

@emaf emaf commented Jun 27, 2025

If the Java executable we are trying to run fails to be be executed (i.e., locked file, broken symlink, or any raeson actually) we should just return an empty dictionary. That way when running GetPathEnvironmentJdkPaths, the invalid/not available executable is just ignored.

Call stack from https://developercommunity.visualstudio.com/t/visual-studio-does-not-see-detect-the-co/10888076

System.ComponentModel.Win32Exception (0x80004005): The system cannot find the path specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at Xamarin.Android.Tools.ProcessUtils.Exec(ProcessStartInfo processStartInfo, DataReceivedEventHandler output, Boolean includeStderr)
   at Xamarin.Android.Tools.JdkInfo.GetJavaProperties(Action`2 logger, String java)
   at Xamarin.Android.Tools.JdkInfo.<GetPathEnvironmentJdkPaths>d__61.MoveNext()

The message The system cannot find the path specified is a bit misleading because we are already validating the file exist before calling GetJavaProperties, and this can only occurr if we found a broken symlink.

If the Java executable we are trying to run fails to be be executed (i.e., locked file, broken symlink, or any raeson actually) we should just return an empty dictionary. That way when running `GetPathEnvironmentJdkPaths`, the invalid/not available executable is just ignored.

Call stack from https://developercommunity.visualstudio.com/t/visual-studio-does-not-see-detect-the-co/10888076
```
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the path specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at Xamarin.Android.Tools.ProcessUtils.Exec(ProcessStartInfo processStartInfo, DataReceivedEventHandler output, Boolean includeStderr)
   at Xamarin.Android.Tools.JdkInfo.GetJavaProperties(Action`2 logger, String java)
   at Xamarin.Android.Tools.JdkInfo.<GetPathEnvironmentJdkPaths>d__61.MoveNext()
```

The message `The system cannot find the path specified` is a bit misleading because we are already validating the file exist before calling `GetJavaProperties`, and this can only occurr if we found a broken symlink.
@jonathanpeppers
Copy link
Member

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@jonathanpeppers jonathanpeppers enabled auto-merge (squash) June 27, 2025 21:34
@jonathanpeppers jonathanpeppers merged commit 8a09cf7 into dotnet:main Jun 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants