Skip to content

Conversation

@simonrozsival
Copy link
Member

@simonrozsival simonrozsival commented Mar 18, 2024

Description of Change

In #19360 we introduced a warning that's reported when XamlC cannot compile a binding because we don't know the data type of the source (x:DataType is missing). To make this warning less confusing to customers, I suggest adding a link to the docs so that it is immediately clear how to improve the code to address the warning.

Also, it might be worth hiding these warnings unless developers opt-in to a "XamlC strict mode". This should be the default for NativeAOT and in .NET 9 it could be the default for all apps. To make migration from Xamarin.Forms easier, we might want to hide these warnings in the next .NET 8 servicing release.

Issues Fixed

Based on feedback in #21277

/cc @StephaneDelcroix @davidortinau

@simonrozsival simonrozsival requested a review from a team as a code owner March 18, 2024 16:14
@bcaceiro
Copy link

As a suggestion, for newcomers, a performance improvement tip would be better ( I know it is in the links), but it is a better call to action for developers. everyone wants performance :)

@StephaneDelcroix
Copy link
Contributor

if we're providing the link for help, we should also make the warning clickable on VS, by supporting HelpLink

@simonrozsival
Copy link
Member Author

@balachir thanks for the suggestion

@PureWeen @jonathanpeppers @StephaneDelcroix I suggest adding a $(MauiXamlCStrictMode) which only defaults to true on NativeAOT (and later possibly also for trim mode full). Unless the strict mode is enabled, we wouldn't warn about missing x:DataType.

@simonrozsival simonrozsival changed the title [X] Improve warning message when a binding cannot be compiled [X] Improve warnings when binding cannot be compiled Mar 19, 2024
@rmarinho
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the improve-missing-xdatatype-warning-message branch from 612092f to ac9a661 Compare March 19, 2024 18:03
Copy link
Contributor

@StephaneDelcroix StephaneDelcroix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it add the exceptions to WarningsNotAsErrors instead of NoWarn, so the warnings will still be displayed ?

@simonrozsival
Copy link
Member Author

@StephaneDelcroix I think it might be better to completely hide the warnings in .NET 8 to decrease friction for customers migrating from Xamarin.Forms.

@StephaneDelcroix
Copy link
Contributor

@StephaneDelcroix I think it might be better to completely hide the warnings in .NET 8 to decrease friction for customers migrating from Xamarin.Forms.

Maybe warning are too harsh, but hiding them will only defer the friction till .NET9 is release. What do you think about logging them as 'Message', like <WarningsAsMessage>XC0022;XC0023</WarningsAsMessage>, and adding a WarningsAsMessage parameter to the Task ?

@simonrozsival
Copy link
Member Author

@StephaneDelcroix would that even be printed to the log (especially with the new msbuild terminal logger)? Wouldn't the messages only be visible in binlogs? At that point, isn't it better to skip the logs altogether?

@simonrozsival
Copy link
Member Author

@StephaneDelcroix I reverted the changes that disable the warnings for now. I suggest we merge the updated warning message and I'll open a separate PR where we can continue the discussion whether to disable those warnings or not.

@StephaneDelcroix StephaneDelcroix merged commit 4749c0b into dotnet:main Mar 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants