Repository navigation
Conversation
Reference the in-repository analyzer unconditionally, keep all-task migration mode explicitly false, and remove warning demotion. Update CI and documentation without modifying the analyzer implementation or its tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use narrow pragmas for verified safe exclusions in RAR, file, URL, launcher, manifest, archive, XML, and redist paths. Explain the fully-qualified-path, absolute-path, temporary-file ownership, or unreachable-branch invariant at each call site without changing runtime behavior. Include bare AbsolutePath.Value uses not yet recognized by the unchanged analyzer. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Suppress the nine remaining sites individually. Document the remaining path-resolution and shared-logging risks without changing runtime behavior or claiming that the suppressions establish safety. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
| global_level = 100 | ||
|
|
||
| msbuild_task_analyzer.run_mt_analyzers_on_all_tasks = true | ||
| msbuild_task_analyzer.run_mt_analyzers_on_all_tasks = false |
Member
There was a problem hiding this comment.
should we have a bug to turn this on?
Comment on lines
+139
to
+144
| #pragma warning disable MSBuildTask0003 // TaskEnvironment supplies a fully qualified source directory. | ||
| _sourceDirectory = new DirectoryInfo(TaskEnvironment.GetAbsolutePath(SourceDirectory.ItemSpec).Value); | ||
| #pragma warning restore MSBuildTask0003 | ||
| #pragma warning disable MSBuildTask0003 // TaskEnvironment supplies a fully qualified destination path. | ||
| _destinationFile = new FileInfo(TaskEnvironment.GetAbsolutePath(DestinationFile.ItemSpec).Value); | ||
| #pragma warning restore MSBuildTask0003 |
Member
There was a problem hiding this comment.
Confused by these -- they're using GetAbsolutePath. Is that not enough?
| } | ||
| else | ||
| { | ||
| #pragma warning disable MSBuildTask0005 // ResolveComReference loads PIAs in its per-invocation AppDomain, isolated from other tasks. |
Member
There was a problem hiding this comment.
Are CWD and thus relative paths AppDomain isolated?
| { | ||
| #pragma warning disable MSBuildTask0003 // destinationFolderPath is fully qualified by TaskEnvironment. | ||
| destinationDirectory = Directory.CreateDirectory(destinationFolderPath); | ||
| #pragma warning restore MSBuildTask0003 |
Member
There was a problem hiding this comment.
I think this one could just be fixed?
Suggested change
| #pragma warning restore MSBuildTask0003 | |
| AbsolutePath destinationFolderPath = TaskEnvironment.GetAbsolutePath(DestinationFolder.ItemSpec); | |
| try | |
| { | |
| destinationDirectory = Directory.CreateDirectory(destinationFolderPath); |
Comment on lines
+134
to
+136
| #pragma warning disable MSBuildTask0003 // TaskEnvironment supplies a fully qualified archive path. | ||
| FileInfo sourceFile = new FileInfo(TaskEnvironment.GetAbsolutePath(sourceItem.ItemSpec).Value); | ||
| #pragma warning restore MSBuildTask0003 |
Member
There was a problem hiding this comment.
Suggested change
| #pragma warning disable MSBuildTask0003 // TaskEnvironment supplies a fully qualified archive path. | |
| FileInfo sourceFile = new FileInfo(TaskEnvironment.GetAbsolutePath(sourceItem.ItemSpec).Value); | |
| #pragma warning restore MSBuildTask0003 | |
| FileInfo sourceFile = new FileInfo(TaskEnvironment.GetAbsolutePath(sourceItem.ItemSpec)); |
| if (FileSystems.Default.DirectoryExists(redistDirectory)) | ||
| { | ||
| // RAR supplies resolved framework directories under Wave18_13; other callers use framework installation paths. | ||
| #pragma warning disable MSBuildTask0005 |
Member
There was a problem hiding this comment.
Why is this firing here instead of on the DirectoryExists call above?
| try | ||
| { | ||
| var readerSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Ignore, CloseInput = true }; | ||
| #pragma warning disable MSBuildTask0005 // AssemblyTableInfo validates that Path is fully qualified. |
Member
There was a problem hiding this comment.
- string path = assemblyTableInfo.Path.Value;
+ AbsolutePath path = assemblyTableInfo.Path;then?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially fixes #15208
Summary
Run the task analyzer in all
Microsoft.Build.Tasksbuilds instead of only whenBuildAnalyzer=true.Existing findings are suppressed at the individual call site with either:
TODOlinking the unresolved behavior to Investigate AbsolutePath migration recommendation robustness with UNC and Drive-relative paths #13196 or Consider MT-safe refactor of ManifestUtil library #13645.Testing
.\build.cmd -v quiet -msbuildEngine dotnet— passed with 0 warnings and 0 errors.