Add Roslyn analyzer (MSBuildTask0008) warning for unsupported ITaskItem<T> type arguments#13973
Draft
baronfel wants to merge 1 commit into
Draft
Conversation
012beff to
f4d5fe0
Compare
066020c to
a06f9e6
Compare
Emit a Warning when a task property is typed as ITaskItem<T> or ITaskItem<T>[] where T is not in the set of types that MSBuild's ValueTypeParser can parse at runtime. Using an unsupported type causes a runtime failure during parameter binding. Supported types: bool, char, byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, string, AbsolutePath, FileInfo, DirectoryInfo. No code fix is offered as the fix depends on intended semantics. The diagnostic fires on all ITask implementations (not just multithreaded tasks) since it is always a correctness issue. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f4d5fe0 to
6b6a7d7
Compare
a06f9e6 to
7531acb
Compare
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.
Summary
Adds MSBuildTask0008 (UnsupportedTaskItemType): a Roslyn analyzer that fires when a task property uses ITaskItem where T is not a supported type. This catches cases where a developer accidentally uses an unsupported generic type argument that would fail at runtime.
Stacked on
/cc @baronfel