Skip to content

Add Roslyn analyzer (MSBuildTask0008) warning for unsupported ITaskItem<T> type arguments#13973

Draft
baronfel wants to merge 1 commit into
typed-params/migration-analyzersfrom
typed-params/unsupported-type-analyzer
Draft

Add Roslyn analyzer (MSBuildTask0008) warning for unsupported ITaskItem<T> type arguments#13973
baronfel wants to merge 1 commit into
typed-params/migration-analyzersfrom
typed-params/unsupported-type-analyzer

Conversation

@baronfel

@baronfel baronfel commented Jun 5, 2026

Copy link
Copy Markdown
Member

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

@baronfel baronfel changed the title Add MSBuildTask0008 warning for unsupported ITaskItem<T> type arguments Add Roslyn analyzer (MSBuildTask0008) warning for unsupported ITaskItem<T> type arguments Jun 5, 2026
@baronfel baronfel force-pushed the typed-params/migration-analyzers branch from 012beff to f4d5fe0 Compare June 5, 2026 21:11
@baronfel baronfel force-pushed the typed-params/unsupported-type-analyzer branch from 066020c to a06f9e6 Compare June 5, 2026 21:12
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>
@baronfel baronfel force-pushed the typed-params/migration-analyzers branch from f4d5fe0 to 6b6a7d7 Compare June 5, 2026 21:22
@baronfel baronfel force-pushed the typed-params/unsupported-type-analyzer branch from a06f9e6 to 7531acb Compare June 5, 2026 21:22
@baronfel baronfel requested a review from a team June 8, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant