Commit 876442f
authored
[generator] Fix MSBuild warning/error format for Visual Studio (dotnet#765)
In b858dc5 we updated `generator` warnings/errors to give line &
column information in more places. However, the existing method for
formatting the line & column information was wrong:
// Correct
C:\code\Metadata.xml(2, 6): warning BG8A04: <attr path="/api/package[@name='androidx.appcompat.widget']/class[@name='RoundRectDrawableWithShadow']"/> matched no nodes.
// Incorrect
C:\code\Metadata.xml(2, 6) warning BG8A04: <attr path="/api/package[@name='androidx.appcompat.widget']/class[@name='RoundRectDrawableWithShadow']"/> matched no nodes.
By omitting the colon after the line & column information,
Visual Studio parses the colon within `C:\` instead, resulting in:

* Filename: `C`
* Line number: 1
This is actually worse than what we previously had, as double-clicking
it does nothing, as `C` is not a valid file on disk.
Rewrite the `Report.Format()` method to be a little clearer to read
and add the required colon.1 parent 3f6cf72 commit 876442f
File tree
2 files changed
+49
-3
lines changed- tests/generator-Tests/Unit-Tests
- tools/generator/Utilities
2 files changed
+49
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
135 | 151 | | |
136 | 152 | | |
137 | 153 | | |
| |||
0 commit comments