-
Notifications
You must be signed in to change notification settings - Fork 693
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
[WindowsAppSDK1.4 ]Exception on Close() ( AppWindow is set as parent of Xaml Window ) #9203
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you! Closed similar issues:
|
I don't think issue is same as above mentioned links. |
The issue in general here is that a window that is written as a top level window may not function correctly as a child window. Microsoft.UI.Xaml.Window has no means of creating the window as a child, which means that this scenario is not supported. This does have an effect, for example, broadcast messages are only ever sent to top level windows. Changing the parent of a window is also problematic in general. The child window has to be aware of this kind of thing in order to work. To put it simply, WinUI 3 does not support the main window being set as a child window, it never did. The fact that it worked in earlier versions of the Windows App SDK releases is just luck. There is also a bug report that describes this same layout somewhere, but it was stated that this was by design. I'll see if I can find that. --Edit-- Right, #8900 is what I was thinking of. |
Ok. Understood. Thank you for explanation. |
Resolving as dup of #8900 |
Issue is only in WindowsAppSDK1.4 , not in 1.3.
An AppWindow is created and is made as a parent to XamlWindow. On button( of XamlWindow) click , Close() is called. Which resulted in exception.
Steps to reproduce the bug
A simple WinUI3 ( WinRT c++ ) app is created. WindowsAppSDK1.4 is created.
By default a xaml window is there ( MainWindow.xaml ). On Button click of MainWindow, another window is created.
In the above code an AppWindow is created, a Xaml window is created.
AppWindow is set as parent to Xaml window.
::SetParent(hMsgWnd, hAppWnd);
BlankWindow
A simple window added to project.
On button click on BlankWindow, Close is called, which creates exception/crash.
Exception thrown at 0x00007FFF49751328 (Microsoft.ui.xaml.dll) in App5.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
[CallStack]
If we didn't made AppWindow as parent to BlankWindow, Close works fine.
Expected behavior
No response
Screenshots
NuGet package version
None
Windows version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: