dotnet / dotnet/msbuild

[Feature Request]: Make error message more helpful when `TaskItem.ItemSpec` is not set

Open
#10,660 4 comments 0 reactions 0 assignees View on GitHub
Area: Debuggability Area: Documentation Feature Request Priority:3 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

Hello,

Improve error message if `ItemSpec` is missing on a `TaskItem`

### Background and Motivation

When creating a custom MSBuild task, it took me several hours to figure out why I was getting this error:

```
error MSB4028: The "EasyBuild.PackageReleaseNotes.Tasks.GetCurrentReleaseTask" task's outputs could not be retrieved from the "CurrentRelease" parameter. Parameter "includeEscaped" cannot have zero length.
```

The reason was that I didn't set the `TaskItem.ItemSpec` value.

### Proposed Feature

Improve the error message to mention that ItemSpec should be set.

```
The "EasyBuild.PackageReleaseNotes.Tasks.GetCurrentReleaseTask" task's outputs could not be retrieved from the "CurrentRelease" parameter. Please set the value of ItemSpec, in your task.
```

### Alternative Designs

Another solution would be to change the constructor of `TaskItem` to take a mandatory `ItemSpec` value, but I suspect it would be too big of a breaking change.

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.