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

WinUI 2 Xaml islands NavigationViewItem.Content property set TextBlock cause app crash #9220

Closed
Gaoyifei1011 opened this issue Jan 10, 2024 · 1 comment
Labels
area-External Not owned by the WinUI team, not actionable in this repository. area-NavigationView NavView control bug Something isn't working product-winui2 team-Controls Issue for the Controls team

Comments

@Gaoyifei1011
Copy link

Gaoyifei1011 commented Jan 10, 2024

Describe the bug

WinUI 2 Xaml islands NavigationViewItem.Content property set TextBlock cause app crash.

When I use the navigation control of WinUI2 in Mile.Xaml, when I try to set the Content property as a string value directly in the NavigationViewItem, the application works fine and can display the string, but when the Content property is set to a Textblock, the application is abnormal, and the value does not fall within the expected range.

我在Mile.Xaml中使用 WinUI2的导航控件时,当尝试在NavigationViewItem中直接设置Content属性为字符串值时,应用程序正常运行,并能显示出字符串,但是当Content属性设置成一个Textblock 时,应用发生异常,提示Value does not fall within the expected range.

Steps to reproduce the bug

See ScreenShots

Expected behavior

在NavigationViewItem.Content 属性中设置 Textblock 时可以正常显示。
When the Textblock is set in the NavigationViewItem.Content property, it appears as expected.

Screenshots

b2d46d4b7892584ffdcd5b773201bcbb
image
4874e7692999010073838d1b3c483fd3
60bb53f767182dd30ed7abdd4997b6ad

NuGet package version

WinUI 2 - Microsoft.UI.Xaml 2.8.2

Windows version

Windows 11 (22H2): Build 22621

Additional context

希望能在2.8.7版本中修复这个问题
Hopefully this will be fixed in version 2.8.7

异常信息

Source:
StackTrace:
HelpLink:
HResult:-2147024809
Message:参数错误。

参数错误。

Source:
StackTrace: at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
at Mile.Xaml.WindowsXamlHostBase.OnWindowXamlHostSizeChanged(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
at System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Form.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at WindowsTools.Views.Windows.MainWindow.OnSizeChanged(EventArgs args)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at WindowsTools.Views.Windows.MainWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
HelpLink:
HResult:-2147024809
Message:Value does not fall within the expected range.

@Gaoyifei1011 Gaoyifei1011 added the bug Something isn't working label Jan 10, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 10, 2024
@Gaoyifei1011 Gaoyifei1011 changed the title WinUI 2 Xaml islands NavigationViewItem.Content property add TextBlock cause app crash WinUI 2 Xaml islands NavigationViewItem.Content property set TextBlock cause app crash Jan 10, 2024
@bpulliam bpulliam added area-NavigationView NavView control team-Controls Issue for the Controls team product-winui2 and removed needs-triage Issue needs to be triaged by the area owners labels Jan 18, 2024
@ranjeshj
Copy link
Contributor

@Gaoyifei1011 The crash stack is in Mile.Xaml. Please try posting this issue in their repo - https://github.com/ProjectMile/Mile.Xaml

@ranjeshj ranjeshj closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
@ranjeshj ranjeshj added the area-External Not owned by the WinUI team, not actionable in this repository. label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-External Not owned by the WinUI team, not actionable in this repository. area-NavigationView NavView control bug Something isn't working product-winui2 team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

3 participants