Task factories Shows Misleading Errors When Failing on internal operations
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
### Issue Description
Found in https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1272722
Building a project that uses a task factory that fails to parse its input, the error reported is misleading. See below for the error. It should be something like "TaskFactory Failed: {stack-trace-etc}".
### Steps to Reproduce
Build a project/xaml file like so:
`project.proj`
```xml
Test.xaml
```
`test.xaml`
```xaml
```
### Expected Behavior
Error saying the task factory itself failed on the backticks existing in the xaml file.
### Actual Behavior
We get both "taskfactory couldn't be loaded" and "
```
Build started 5/6/2021 2:11:30 PM.
Project "C:\src\issues\cudaproject\project.proj" on node 1 (default targets).
C:\src\issues\cudaproject\project.proj(3,5): error MSB4175: The task factory "XamlTaskFactory" could not be loaded
from the assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
'`' is an unexpected token. The expected token is '"' or '''. Line 1, position 33.
Done Building Project "C:\src\issues\cudaproject\project.proj" (default targets) -- FAILED.
Build FAILED.
```
### Analysis
The error suggests the task factory was found just fine, but there was an error while parsing the xaml to create the task.
### Versions & Configurations
`msbuild --version`
```
Microsoft (R) Build Engine version 16.10.0-dev-21205-01+86be06394 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
16.10.0.20501
```
### Notes
Does this also happen with other `TaskFactory` classes?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the failure with project.proj and test.xaml using XamlTaskFactory, then trace how the task factory load error is produced during XAML parsing. Done means the build reports that the task factory failed because of the malformed backticks, rather than saying the factory could not be loaded.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100