microsoft / microsoft/microsoft-ui-xaml
Can't get error output from XamlCompiler.exe
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
I'm trying to experiment with using the standalone `XamlCompiler.exe`. One thing I noticed is that it doesn't seem to really report any errors, it just fails with exit code 1.
Upon closer inspection, it seems any entry added to the `ConsoleLogger` used by the standalone program isn't really output in the case of error.
The only use of `ConsoleLogger.Entries` is in `SaveResults()`. That, however, is only executed in the case of success:
https://github.com/microsoft/microsoft-ui-xaml/blob/35c590bb28841eb9d466624bb828c78b939d4312/src/src/XamlCompiler/BuildTasks/ConsoleCompileXaml.cs#L77
So it seems if there's an error, the actual message isn't actually output anywhere...
### Steps to reproduce the bug
1. Craft an input JSON file for `XamlCompiler.exe` that successfully parses:
```json
{
"Language" : "CppWinRT",
"LanguageSourceExtension" : ".cpp",
"OutputPath" : "D:/sources/xamlc_standalone_test/build/generated",
"ProjectPath" : "D:/sources/xamlc_standalone_test",
"ReferenceAssemblies" : [],
"ReferenceAssemblyPaths" : [],
"TargetPlatformMinVersion" : "10.0.17763.0",
"XamlPages" :
[
{
"FullPath" : "D:/sources/xamlc_standalone_test/MainWindow.xaml",
"ItemSpec" : "D:/sources/xamlc_standalone_test/MainWindow.xaml"
}
]
}
```
2. Run `XamlCompiler.exe` manually
3. Notice the error return, but don't see any error output (or output json)
### Expected behavior
_No response_
### Screenshots
The standalone compiler should report errors, at least to the console, if it doesn't produce an output json.
### NuGet package version
WinUI 3 - Windows App SDK 1.6.0: 1.6.240829007
### Windows version
Windows 11 (22H2): Build 22621
### Additional context
_No response_
Contributor guide
Research direction
Start in src/src/XamlCompiler/BuildTasks/ConsoleCompileXaml.cs, especially the SaveResults() call and the ConsoleLogger. Run the standalone XamlCompiler.exe with the input JSON from the reproduction steps; done means a failing compilation reports its error output or output JSON instead of only returning exit code 1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100