SourceGenerators: MSBuild property (and metadata?) values are (potentially) truncated before being passed to Generator #72592
Labels
Area-Compilers
Bug
Feature - Source Generators
Source Generators
Resolution-Duplicate
The described behavior is tracked in another issue
Milestone
Version Used:
4.9.0-3.24121.1 (a98c90d)
Steps to Reproduce:
;
characterExpected Behavior:
A property value identical to what is available in MSBuild - Here exception from the generator with a message of
... Exception was of type 'Exception' with message 'Property value was: Wiz;Bang'.
Actual Behavior:
A property value that is truncated at the first use of the
;
character - Here exception from the generator with a message of... Exception was of type 'Exception' with message 'Property value was: Wiz'.
It seems as if property values get truncated at
;
characters before getting passed to the generator. The Incremental Generators Cookbook does not mention any forbidden characters ;)I have not tested if the same issue occurs when using MSBuild Metadata (aka
build_metadata.FooItem.BarMetedata
) but would very much assume so.This is quite the annoying bug because it is not unreasonable to want to pass ItemGroups to a generator, and setting a property to a simple
<Foo>@(SomeGroup)</Foo>
serializes the item group with;
as separator.I'm assuming this is happening because the analyzer gets fed with some
key1=...;key2=...;...
format, internally using;
as a separator, and the MSBuild to generator transition does not (cannot?) properly escape semicolons before building that format.Minimal Repo Solution:
AnalyzerMsBuildPropertyIssues.zip
The text was updated successfully, but these errors were encountered: