dotnet / dotnet/macios

Error message when ACTool fails to copy file could be improved to list file in question

Open
#13,473 6 comments 0 reactions 0 assignees View on GitHub
copilot-candidate feature msbuild
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

On my local machine ACTool started failing with access denied:

```
/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/12.0.101-preview.10.249/tools/msbuild/macOS/Xamarin.Shared.targets(748,3): error MSB4018: The "ACTool" task failed unexpectedly.
System.UnauthorizedAccessException: Access to the path is denied.
---> System.IO.IOException: Operation not permitted
--- End of inner exception stack trace ---
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
at Xamarin.MacDev.Tasks.ACToolTaskBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs:line 275
at Xamarin.MacDev.Tasks.ACTool.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs:line 13
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/Users/kirill/vsmac2/main/src/core/VisualStudio/VisualStudio.csproj]
```

The File.Copy operation that is failing is here:
https://github.com/xamarin/xamarin-macios/blob/78f52e2fc238ba731bf993d6d2b6d4b142ab8a48/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs#L275

I'm guessing there should be a try/catch around that File.Copy that would log the source and destination file paths before throwing. Right now it's hard to understand which file is being copied where and why it's failing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.