Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XamlC] Fix error XDataTypeSyntax message format #20787

Merged

Conversation

simonrozsival
Copy link
Member

Description of Change

Invalid syntax in x:DataType reported a weird error message:

MainPage.xaml : XamlC error : Input string was not in a correct format. Failure to parse near offset 69. Unexpected closing brace without a corresponding opening brace. [MyMauiApp/MyMauiApp.csproj::TargetFramework=net9.0-maccatalyst]

With the fix in the error message, this is printed instead:

MainPage.xaml(11,33): XamlC error XFC0102: x:DataType expects a string literal, an {{x:Type}} markup or {{x:Null}}. [MyMauiApp/MyMauiApp.csproj::TargetFramework=net9.0-maccatalyst]

Questions

  • Should this be fixed in main or just in net9.0?
  • Are the double curly brackets what we actually want? Is it necessary to prevent string interpolation in some context?

@simonrozsival simonrozsival requested a review from a team as a code owner February 22, 2024 18:49
@jsuarezruiz jsuarezruiz added the area-xaml XAML, CSS, Triggers, Behaviors label Feb 23, 2024
@StephaneDelcroix
Copy link
Contributor

thanks for this. could go to main, and yes, those messages are processed by String.Format to replace positional arguments

@simonrozsival
Copy link
Member Author

@StephaneDelcroix I thought that could be the case. Should we then maybe drop the {{ }} altogether?

MainPage.xaml(11,33): XamlC error XFC0102: x:DataType expects a string literal, an {{x:Type}} markup or {{x:Null}}.

vs.

MainPage.xaml(11,33): XamlC error XFC0102: x:DataType expects a string literal, an x:Type markup or x:Null.

@StephaneDelcroix
Copy link
Contributor

the processed error message should show single {}

@simonrozsival
Copy link
Member Author

@StephaneDelcroix I'm getting the {{x:Type}} with double curly braces in the build output.

@rmarinho rmarinho merged commit 0a86b8a into dotnet:net9.0 Feb 28, 2024
44 of 47 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants