-
Notifications
You must be signed in to change notification settings - Fork 554
[msbuild] Show an error if SdkDevPath hasn't been set and we're executing a process. #24555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -111,17 +111,23 @@ protected string GetSdkPlatform (bool isSimulator) | |||||||
|
|
||||||||
| internal protected System.Threading.Tasks.Task<Execution> ExecuteAsync (string fileName, IList<string> arguments, Dictionary<string, string?>? environment = null, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null) | ||||||||
| { | ||||||||
| return ExecuteAsync (Log, fileName, arguments, SdkDevPath, environment, showErrorIfFailure, workingDirectory, cancellationToken); | ||||||||
| return ExecuteAsync (this, fileName, arguments, SdkDevPath, environment, showErrorIfFailure, workingDirectory, cancellationToken); | ||||||||
| } | ||||||||
|
|
||||||||
| static int executionCounter; | ||||||||
| static async System.Threading.Tasks.Task<Execution> ExecuteAsync (TaskLoggingHelper log, string fileName, IList<string> arguments, string? sdkDevPath = null, Dictionary<string, string?>? environment = null, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null) | ||||||||
| static async System.Threading.Tasks.Task<Execution> ExecuteAsync (Task task, string fileName, IList<string> arguments, string? sdkDevPath = null, Dictionary<string, string?>? environment = null, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null) | ||||||||
| { | ||||||||
| var log = task.Log; | ||||||||
| // Create a new dictionary if we're given one, to make sure we don't change the caller's dictionary. | ||||||||
| var launchEnvironment = environment is null ? new Dictionary<string, string?> () : new Dictionary<string, string?> (environment); | ||||||||
| if (!string.IsNullOrEmpty (sdkDevPath)) | ||||||||
| launchEnvironment ["DEVELOPER_DIR"] = sdkDevPath; | ||||||||
|
|
||||||||
| if (Environment.OSVersion.Platform == PlatformID.MacOSX && string.IsNullOrEmpty (sdkDevPath)) { | ||||||||
| log.LogError (MSBStrings.E7164 /* The task '{0}' is trying to call an external process, but a path to Xcode has not been provided. Please file an issue at https://github.com/dotnet/macios/issues/new/choose. */, task.GetType ().Name); | ||||||||
| log.LogMessage (MessageImportance.Low, Environment.StackTrace); | ||||||||
|
||||||||
| log.LogMessage (MessageImportance.Low, Environment.StackTrace); | |
| log.LogMessage (MessageImportance.Low, Environment.StackTrace); | |
| throw new InvalidOperationException ("The task is trying to call an external process, but a path to Xcode has not been provided."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging Environment.StackTrace here will show the stack from where Environment class is called, not the actual call stack leading to this error. Consider using new StackTrace().ToString() instead to get the actual call stack, which would be more useful for debugging.