-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GenerateToolsSettingsFile causes incremental build issues #17454 8000
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
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Co-authored-by: Michael Simons <msimons@microsoft.com>
I'm running into this quite frequently now since updating to the .NET 9.0.200 SDK but only on Windows (this build is up to 16 attempts now). |
As of #32798 this target should be properly incremental - however as @martincostello is finding it's generating the tool command xml file per-TFM, while that file is generated to a TFM-oblivious location. We either need to do the safe thing and generate separate, per-TFM XML files or figure out another mechanism to ensure that the Target's only called once (or at least called with enough staggering so that projects building on different nodes can see that the cache has been populated. |
@martincostello consider instead of multi-targeting your tool, setting |
For now I've just done this: |
Triage: since this seems to be happening more frequently, let's take a look at putting these in files in subfolders during the build as they get packed in TFM specific folders so that should work. |
@dotnet/dotnet-cli Looks like this is starting to fail in our build pipelines somewhat frequently. #47696 was recently filed for this, and I just hit a failure for this too: https://dev.azure.com/dnceng-public/public/_build/results?buildId=986435&view=ms.vss-test-web.build-test-results-tab&runId=26317906&resultId=103428&paneView=debug So we should probably prioritize fixing this. And now I realize it's assigned to me :-) |
We're hitting this frequently now too - will the fix be backported to the 9.x.x SDK do you know? Thanks |
## Summary of changes Try to fix the flake we're been seeing in the `dotnet pack` stack of the runner build ## Reason for change Seeing flake like this, which [seems to be happening in `9.0.2xx` of the SDK](dotnet/sdk#17454) ``` The "GenerateToolsSettingsFile" task failed unexpectedly. System.IO.IOException: The process cannot access the file 'D:\a\1\s\tracer\src\Datadog.Trace.Tools.Runner\obj\DotnetToolSettings.xml' because it is being used by another process. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) at System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) at System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options) at Microsoft.NET.Build.Tasks.TaskBase.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) ``` ## Implementation details Try setting `BuildInParallel=false` [as suggested in this issue](dotnet/sdk#17454 (comment)) ## Test coverage If this build works, we're ok ## Other details The issue appears to be fixed in the .NET 10 SDK: - dotnet/sdk#17454 (comment) I've asked to see if it will backported, but no answer yet 🙄
The
GenerateToolsSettingsFile
task unconditionally writesDotnetToolSettings.xml
on every build. This causes issues with incremental builds; specifically,dotnet pack
will always generate a fresh package because theGenerateNuspec
target considers this file as one of its inputs.I'm not sure what the proper fix is here. Maybe
GenerateToolsSettingsFile
should compare the generated document with the existing file and only write the document if it's different?The text was updated successfully, but these errors were encountered: