Skip to content

fix: Display of DialogInfo properties in UI#1734

Open
jonpryor wants to merge 1 commit intomainfrom
dev/jonpryor/jonp-preserve-Model-properties
Open

fix: Display of DialogInfo properties in UI#1734
jonpryor wants to merge 1 commit intomainfrom
dev/jonpryor/jonp-preserve-Model-properties

Conversation

@jonpryor
Copy link
Copy Markdown
Collaborator

@jonpryor jonpryor commented Feb 9, 2026

Context: 06f4f80
Context: unoplatform/uno.extensions#3022
Context: microsoft/microsoft-ui-xaml#8723

Build and run Chefs.csproj for e.g. net10.0-desktop and Native AOT while using Uno 6.6.0-dev.3:

sed -i '' 's/"Uno.Sdk": ".*"/"Uno.Sdk": "6.6.0-dev.3"/g' global.json
git clean -xdf Chefs{,.Api}
dotnet publish -c Release -r osx-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
  -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SkiaPublishAot=true \
  -p:IlcGenerateMapFile=true -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMetadataLog=true \
  -p:EmitCompilerGeneratedFiles=true -p:CompilerGeneratedFilesOutputPath=`pwd`/_gen
Chefs/bin/Release/net10.0-desktop/osx-x64/publish/Chefs

From the launch screen:

  1. Click Skip
  2. Click  Sign in with Apple
  3. Click ❤️Favorites in the left-hand pane
  4. Click the My Cookbooks tab
  5. Click the ➕Add floating-action-button (bottom-right)
  6. Leave the Cookbook name field blank.
  7. Click the Create cookbook button.

The problem is that the dialog which is shown is empty:

(no content here)
[Close]

Empty error dialog

The app log output contains:

fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
      The [Title] property getter does not exist on type [Chefs.Business.Models.DialogInfo]
fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
      The [Content] property getter does not exist on type [Chefs.Business.Models.DialogInfo]

As with commit 06f4f80, the problem is due to missing reflection metadata, and as with 06f4f80, there are "two" fixes, but really only one fix:

  1. Add [Microsoft.UI.Xaml.Data.BindableAttribute] to the type indicated in the fail message: DialogInfo.

  2. Add [System.Diagnostics.CodeAnalysis.DynamicDependency] to the constructor for all properties present in the type.

(1) is the easy solution, but as seen in 06f4f80, this causes build errors when targeting WinRT due to microsoft/microsoft-ui-xaml#8723.

Thus (2) is the only viable solution, tedious as it is.

With this fix in place the error dialog is now displayed as:

Error
Please write a cookbook name and select one recipe.
[Close]

Error dialog with content

GitHub Issue (If applicable): #

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Internal Issue (If applicable):

Context: 06f4f80
Context: unoplatform/uno.extensions#3022
Context: microsoft/microsoft-ui-xaml#8723

Build and run `Chefs.csproj` for e.g. net10.0-desktop and Native AOT
while using Uno 6.6.0-dev.3:

	sed -i '' 's/"Uno.Sdk": ".*"/"Uno.Sdk": "6.6.0-dev.3"/g' global.json
	git clean -xdf Chefs{,.Api}
	dotnet publish -c Release -r osx-x64 -f net10.0-desktop -p:TargetFrameworkOverride=net10.0-desktop \
	  -bl Chefs/Chefs.csproj -p:UseSkiaRendering=true -p:SkiaPublishAot=true \
	  -p:IlcGenerateMapFile=true -p:IlcGenerateMstatFile=true -p:IlcGenerateDgmlFile=true -p:IlcGenerateMetadataLog=true \
	  -p:EmitCompilerGeneratedFiles=true -p:CompilerGeneratedFilesOutputPath=`pwd`/_gen
	Chefs/bin/Release/net10.0-desktop/osx-x64/publish/Chefs

From the launch screen:

 1. Click **Skip**
 2. Click ** Sign in with Apple**
 3. Click **❤️Favorites** in the left-hand pane
 4. Click the **My Cookbooks** tab
 5. Click the **➕Add** floating-action-button (bottom-right)
 6. Leave the *Cookbook name* field blank.
 7. Click the **Create cookbook** button.

The problem is that the dialog which is shown is *empty*:

> (no content here)
> **[Close]**

![Empty error dialog][0]

The app log output contains:

	fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
	      The [Title] property getter does not exist on type [Chefs.Business.Models.DialogInfo]
	fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
	      The [Content] property getter does not exist on type [Chefs.Business.Models.DialogInfo]

As with commit 06f4f80, the problem is due to missing reflection
metadata, and as with 06f4f80, there are "two" fixes, but really
only one fix:

 1. Add `[Microsoft.UI.Xaml.Data.BindableAttribute]` to the type
    indicated in the `fail` message: `DialogInfo`.

 2. Add `[System.Diagnostics.CodeAnalysis.DynamicDependency]` to the
    constructor for all properties present in the type.

(1) is the easy solution, but as seen in 06f4f80, this causes build
errors when the type contains `init` or `required` properties *and* the
app targets WinRT, due to microsoft/microsoft-ui-xaml#8723.

Thus (2) is the only viable solution, tedious as it is.

With this fix in place the error dialog is now displayed as:

> **Error**
> Please write a cookbook name and select one recipe.
> **[Close]**

![Error dialog with content][1]

[0]: https://private-user-images.githubusercontent.com/155958/541582643-59b816c3-b01a-4c25-a6b1-2977fc0ab573.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzA2Njg5NTQsIm5iZiI6MTc3MDY2ODY1NCwicGF0aCI6Ii8xNTU5NTgvNTQxNTgyNjQzLTU5YjgxNmMzLWIwMWEtNGMyNS1hNmIxLTI5NzdmYzBhYjU3My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIwOVQyMDI0MTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lNTkyMDAxODBjN2VkZGE4ZjRhZjg2Y2Q0MWRhNzBiNzRiYzU1MGM4YWNkNmY5OGE4ODllMDNiOWZlZjA0MTQ0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.xkdLy2wy4pY3kEgX33v76v5AwUwWGw_fj4MSXO6WdqE
[1]: https://private-user-images.githubusercontent.com/155958/541582597-0b152753-b204-4cb8-9cd8-d17df7a8e5de.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzA2Njg5NTQsIm5iZiI6MTc3MDY2ODY1NCwicGF0aCI6Ii8xNTU5NTgvNTQxNTgyNTk3LTBiMTUyNzUzLWIyMDQtNGNiOC05Y2Q4LWQxN2RmN2E4ZTVkZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDIwOVQyMDI0MTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kZDZlODVjNGFiZDY2YzhiZDcwYzIxYTM1NzI5YzA0NjAwODY3YTk4M2VmZjQxMGNlY2Q3NDRhODVhZWFlMjY1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.6rYPKy5v42mIfqOEAETbOlAKfHuZI0WVtQKaU4ttDAw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants