Misleading error message when passing wrong argument to static method.
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 135
Description
### Steps to reproduce
```
$([MSBuild]::Multiply(10000000, $(MultiplyValue)))
```
Basically, using a static MSBuild method passing it an invalid argument.
In my case it was just not being defined because it was defined by another props file that wasn't included correctly.
### Expected behavior
A new error message telling the user the issue is caused by the wrong argument being passed to the method instead of the generic error message telling me that the static method was not found.
I looked at the error message online and could only fine people talking about how MSBuild or Visual Studio needed to be repaired, uninstalled and reinstalled because for some reason it couldn't find the definition for the static method I was trying to call.
### Actual behavior
Error message:
```
Invalid static method invocation syntax:
'[MSBuild]::Multiply(10000000, $(MultiplyValue))', Method '[MSBuild]::Multiply' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)).
```
The _** Method X not found**_ piece is the confusing one because it makes it sound like MSBuild doesn't have a multiply method.
Everywhere I looked people said that usually happens when MSBuild is out of date or not installed correctly.
### OS info:
Visual Studio Enterprise 2017 - Version 15.9.15
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the MSBuild static method invocation with the invalid MultiplyValue argument shown in the issue, then trace the static method invocation diagnostic. Done means the error explains that the argument is invalid or missing instead of reporting that the Multiply method was not found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100