Update XamlOptionalChanges spec to include new MSBuild properties - #11206
Update XamlOptionalChanges spec to include new MSBuild properties#11206evelynwu-msft wants to merge 2 commits into
Conversation
… configuring code-generated calls to the API
| > [Approach 1](#approach-1--msbuild-properties-recommended) remain inside that | ||
| > renamed generated body. | ||
|
|
||
| #### Example: WinUI 3 packaged / unpackaged app |
There was a problem hiding this comment.
Since DISABLE_XAML_GENERATED_MAIN now renames rather than removes the generated entry point, would it help to show a short example of delegating to XamlGeneratedProgram.XamlGeneratedMain() here? The current sample calls Application.Start() directly, so the new rename behavior isn't demonstrated. #WontFix
There was a problem hiding this comment.
I don't think this is the right place to put that. Unfortunately there is no existing documentation for DISABLE_XAML_GENERATED_MAIN (the only places where it's currently mentioned are as part of samples on how to use unrelated features) so creating that document is part of my task to ensure that this new behavior is documented on MSDN.
| > C#, `wXamlGeneratedMain` in C++/WinRT) so your custom entry point can still | ||
| > delegate to it if desired. Any optional-change calls produced by | ||
| > [Approach 1](#approach-1--msbuild-properties-recommended) remain inside that | ||
| > renamed generated body. |
There was a problem hiding this comment.
Could you clarify the expected pattern when both approaches are combined? e.g. if a developer sets MSBuild properties and defines DISABLE_XAML_GENERATED_MAIN, does delegating to the renamed entry point pick up the MSBuild-generated calls automatically? A brief note on this would help avoid double-enabling surprises.
There was a problem hiding this comment.
Any optional-change calls produced by Approach 1 remain inside that renamed generated body.
This explicitly says that the API calls are still generated and remain in the renamed entry point. Does it not logically follow that, if a developer were to call the renamed entry point from their own main(), those generated API calls would be invoked in addition to whatever the developer is doing in their main()?
|
is there a particular reason the new API uses comma-separated values? Most MSBuild list properties use semicolon-separated values (for example, NoWarn, DefineConstants, etc.), so when I tested the API today, I naturally used semicolons based on my MSBuild experience. That resulted in an error because the API expects commas. I was just curious if there was a specific design reason for choosing commas instead of following the existing MSBuild convention. |
|
Unfortunately, WinAppSDK's In reply to: 5001970239 |
|
@evelynwu-msft Hi, if we define these properties in the If I choose the optimized variant, I would not want the default, unoptimized version to be included as well, since that would unnecessarily increase the app's package size. |
|
There is no change in binary size; these are simply run-time flags that control which branch to take in certain specific parts of the codebase. In reply to: 5048963402 |
PR Type
Description
During API review of the XamlOptionalChanges spec, it was decided that MSBuild properties should be added to enable and control automatic generation of the API calls by XamlCompiler and that this should be the preferred method by which developers enable or disable optional changes. Additionally, it was decided that the behavior of
DISABLE_XAML_GENERATED_MAINshould be modified so that it renames the generated main method instead of removing it entirely thereby allowing custom entry points to delegate to the default implementation if desired.This PR updates the XamlOptionalChanges spec to reflect these decisions.