microsoft / microsoft/microsoft-ui-xaml
`XbfWriter::ProcessXamlTextBuffer` forgets to populate spObjectNodeList
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
In https://github.com/microsoft/microsoft-ui-xaml/blob/main/src/dxaml/xcp/core/Parser/XbfWriter.cpp#L61-L74, `XbfWriter::ProcessXamlTextBuffer` forgets to populate spObjectNodeList like it is done in https://github.com/microsoft/microsoft-ui-xaml/blob/main/src/dxaml/xcp/tools/GenXbfDLL/Main.cpp#L97-L112 . This causes a segmentation fault down the line when the (null) spObjectNodeList is accessed by https://github.com/microsoft/microsoft-ui-xaml/blob/main/src/dxaml/xcp/core/Parser/XbfWriter.cpp#L148 in order to dump the contents of the XAML document into the XBF file.
### Why is this important?
This bug makes the `XamlBinaryWriter.Write` API not work at all, causing a crash and making it impossible to compile XAML to XBF at runtime or by third party tools using the Windows App SDK.
### Steps to reproduce the bug
- Attempt to call `XamlBinaryWriter.Write` with valid input
- Observe a segmentation fault
### Actual behavior
_No response_
### Expected behavior
_No response_
### Screenshots
_No response_
### NuGet package version
1.8.260317003
### Windows version
_No response_
### Additional context
I am trying to work around https://github.com/microsoft/microsoft-ui-xaml/issues/11058 by providing XBF binary data directly instead of a XAML string, which should avoid the troubled codepath.
Contributor guide
Research direction
Inspect XbfWriter::ProcessXamlTextBuffer in src/dxaml/xcp/core/Parser/XbfWriter.cpp, especially lines 61-74 and the later access around line 148. Compare it with the corresponding logic in src/dxaml/xcp/tools/GenXbfDLL/Main.cpp lines 97-112. Reproduce XamlBinaryWriter.Write with valid XAML and confirm it no longer crashes while producing XBF data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100