-
Notifications
You must be signed in to change notification settings - Fork 719
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
Exception on Android and WASM after adding a style to a menuflyoutitem #3216
Comments
System.Exception |
strangely the generated local resource (style) isnt being used anywhere: private void InitializeComponent()
{
var nameScope = new global::Windows.UI.Xaml.NameScope();
NameScope.SetNameScope(this, nameScope);
Content = new global::Windows.UI.Xaml.Controls.Grid
{
RowDefinitions = { ... },
Children =
{
new global::Windows.UI.Xaml.Controls.TextBlock { ... }.MainPage_dec80355600d10724bff248f43da21f1_XamlApply(...),
new global::Windows.UI.Xaml.Controls.CommandBar
{
// Empty collection
SecondaryCommands =
{
new global::Windows.UI.Xaml.Controls.AppBarButton
{
...,
Flyout = new global::Windows.UI.Xaml.Controls.MenuFlyout
{
// Source ..\..\..\..\..\..\..\UnoFlyoutStyleIssue.Shared\MainPage.xaml (Line 33:26)
Items =
{
new global::Windows.UI.Xaml.Controls.MenuFlyoutItem
{
- Style = (Windows.UI.Xaml.Style)global::Windows.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(Windows.UI.Xaml.Style), (global::Windows.UI.Xaml.Application.Current.Resources["menuFlyoutItemStyle"] ?? throw new InvalidOperationException("The resource menuFlyoutItemStyle cannot be found"))),
...
}.MainPage_dec80355600d10724bff248f43da21f1_XamlApply(...),
}
},
// Source ..\..\..\..\..\..\..\UnoFlyoutStyleIssue.Shared\MainPage.xaml (Line 27:18)
}.MainPage_dec80355600d10724bff248f43da21f1_XamlApply(...),
},
// Source ..\..\..\..\..\..\..\UnoFlyoutStyleIssue.Shared\MainPage.xaml (Line 23:10)
}.MainPage_dec80355600d10724bff248f43da21f1_XamlApply(...),
}
}.MainPage_dec80355600d10724bff248f43da21f1_XamlApply(...);
this.Apply(...).Apply(...);
OnInitializeCompleted();
InitializeXamlOwner();
// Source ..\..\..\..\..\..\..\UnoFlyoutStyleIssue.Shared\MainPage.xaml (Line 9:10)
- new global::Windows.UI.Xaml.Style(typeof(global::Windows.UI.Xaml.Controls.MenuFlyoutItem))
- {
- Setters =
- {
- new global::Windows.UI.Xaml.Setter(global::Windows.UI.Xaml.Controls.MenuFlyoutItem.BackgroundProperty, () => (Windows.UI.Xaml.Media.Brush)(Windows.UI.Xaml.Media.Brush)global::Uno.UI.GlobalStaticResources.ApplicationPageBackgroundThemeBrush),
- new global::Windows.UI.Xaml.Setter(global::Windows.UI.Xaml.Controls.MenuFlyoutItem.ForegroundProperty, () => (Windows.UI.Xaml.Media.Brush)(Windows.UI.Xaml.Media.Brush)global::Uno.UI.GlobalStaticResources.ApplicationForegroundThemeBrush),
- new global::Windows.UI.Xaml.Setter(global::Windows.UI.Xaml.Controls.MenuFlyoutItem.OpacityProperty, (double)1d/* double/double, 1, Setter/Value */),
- }
- };
} |
Thanks for the report! Indeed, there's a special case for this, where you defined your style using /cc @davidjohnoliver |
Yes, this should be fixed with #1766. |
Looks like it is related
|
<tc:ImageEx CornerRadius="8" Source="{Binding ImageUrl}" />` <tc:ImageEx
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Width="65"
Height="65"
Margin="15"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{StaticResource OffWhiteBrush}"
CornerRadius="999"
PlaceholderSource="ms-appx:///Assets/oval.png"
PlaceholderStretch="UniformToFill"
Source="{Binding AvatarURL}" /> <tc:ImageEx
Grid.RowSpan="2"
Width="65"
Height="65"
Margin="15"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderBrush="#D4D1C2"
BorderThickness="1"
CornerRadius="999"
PlaceholderSource="ms-appx:///Assets/oval.png"
PlaceholderStretch="UniformToFill"
Source="{Binding ImageUrl}" /> |
Happen on Android for me |
Do I need to create a separate issue for this? |
Tried |
internal static global::Windows.UI.Xaml.Controls.Border Entry2_1
{
get
{
if(!_Entry2_1Initialized)
{
__Entry2_1BackingField =
new global::Windows.UI.Xaml.Controls.Border
{
IsParsing = true
,
// Source ..\..\..\..\..\..\..\Biblioteko.Mobile.Shared\Assets\Resources\Components.xaml (Line 9:6)
}
.Components_f75bd78bb9117596abbc09f0af500bb6_XamlApply((Components_f75bd78bb9117596abbc09f0af500bb6XamlApplyExtensions.XamlApplyHandler0)(c0 =>
{
global::Uno.UI.ResourceResolver.ApplyResource(c0, global::Windows.UI.Xaml.Controls.Border.BackgroundProperty, "ApplicationForegroundThemeBrush", isThemeResourceExtension: true, context: global::Frebo.Biblioteko.Mobile.GlobalStaticResources.__ParseContext_);
global::Uno.UI.FrameworkElementHelper.SetBaseUri(c0, "file:///C:/Users/Andrii/Dev/Frebo/Biblioteko/Biblioteko.Mobile.Shared/Assets/Resources/Components.xaml");
c0.CreationComplete();
}
))
;
_Entry2_1Initialized = true;
}
return __Entry2_1BackingField;
}
} |
Current behavior
Exception generated on execution when loading a page that contains
Expected behavior
No exception should be thrown as on UWP
How to reproduce it (as minimally and precisely as possible)
Example that reproduces the issue is available on
https://github.com/BrianDT/UnoFlyoutStyleIssue
Environment
Nuget Package: Uno.UI
Package Version(s): 2.4.0 and 3.0.0-dev.76
Affected platform(s):
Visual Studio:
Relevant plugins:
Anything else we need to know?
The text was updated successfully, but these errors were encountered: