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

Create better helpers for attaching and fix Window #14772

Merged
merged 8 commits into from
Apr 26, 2023
Merged

Conversation

PureWeen
Copy link
Member

Description of Change

This is the next version of this PR.

  • Modify AttachAndRun on Windows so that the Window is created through the MauiContext. This is important because we have a few places inside our handlers where the window is retrieved via the MauiContext so those windows have to align.
  • This also fixes up issues with tests like InitializingBackgroundUpdatesBackground that use CreateHandlerAndAddToWindow and then make use of AttachAndRun. This allows AttachAndRun to retrieve the correct window as part of its code.
  • I've also added more overloads in this PR for AttachAndRun so that we don't have to always go through the ceremony of createhandler/invokeonuithread/attachplatformview. Now you can just call AttachAndRun on the IView and it'll take care of marshalling and creating for you.

Known issues

The WebViewHandler tests in core on windows are still crashing. Those will be addressed with a different PR because those crashes aren't really related to the changes here.

"src\\Controls\\tests\\Xaml.UnitTests.InternalsHiddenAssembly\\Controls.Xaml.UnitTests.InternalsHiddenAssembly.csproj",
"src\\Controls\\tests\\Xaml.UnitTests.InternalsVisibleAssembly\\Controls.Xaml.UnitTests.InternalsVisibleAssembly.csproj",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason VS keeps wanting to move this so, I'm hoping if we check this in then it'll just be content.

@PureWeen PureWeen marked this pull request as ready for review April 25, 2023 20:37
@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

Copy link
Member

@filipnavara filipnavara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the crash in #14742

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 1 or 2 places where things are not consistent - like some use the AttachAndRun(view) and the others use view.AttachAndRun(context) but this is super nitty and we can fix that as we see them. Maybe there was a reason for some or maybe not. But they all go to the same place and we can merge this PR

@PureWeen PureWeen enabled auto-merge (squash) April 26, 2023 15:28
@PureWeen PureWeen merged commit f7f31f8 into main Apr 26, 2023
29 checks passed
@PureWeen PureWeen deleted the fix_winui_tests branch April 26, 2023 21:02
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants