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

Allow closing of windows when using a MainPage #6316

Merged
merged 2 commits into from
Apr 22, 2022
Merged

Allow closing of windows when using a MainPage #6316

merged 2 commits into from
Apr 22, 2022

Conversation

mattleibow
Copy link
Member

Description of Change

The initial work in #4860, there was work to avoid clearing up the window that is still being used.

This PR reduces the prevention to only prevent the closure of the MainPage window.

Issues Fixed

Fixes #6103
Related to: #4860

Only skip the cleanup on the non-MainPage windows. Extension of #4860
@mattleibow mattleibow added the legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) label Apr 20, 2022
@mattleibow mattleibow added this to the 6.0.300-rc.3 milestone Apr 20, 2022
@mattleibow mattleibow self-assigned this Apr 20, 2022
Comment on lines -84 to -86

if (_singleWindowMainPage != null)
window.Page = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

This was added in #4860 but will never be reached.

</PropertyGroup>
<Import Project="$(MauiNuSpecDirectory)Microsoft.Maui.Controls.MultiTargeting.targets" />
<ItemGroup Condition=" '$(TargetPlatformIdentifier)' == 'android' ">
<!-- remove other AndroidX packages from the MultiTargeting -->
<PackageReference Remove="*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.GenAPI" Version="6.0.0-*" PrivateAssets="all" />
Copy link
Member Author

Choose a reason for hiding this comment

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

This should never have reached main. It was me testing things. :(

Copy link
Member

@rachelkang rachelkang left a comment

Choose a reason for hiding this comment

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

Deploying to Android device is failing for me :(

@rachelkang
Copy link
Member

Deploying to Android device is failing for me :(

@mattleibow here's a gist of the errors: https://gist.github.com/rachelkang/2751bf23ff2b579f8b63c1886be1ec51

I'm only seeing this on this branch and not on main / other branches

@mattleibow
Copy link
Member Author

These errors are not connected since the nugets are basically just a build task to write some text files.

Did you git clean?

@rachelkang
Copy link
Member

@mattleibow yeah I did git clean -xfd :/

This is what shows up in the error list:
Error MSB3491 Could not write lines to file "obj\staticwebassets.pack.sentinel". The process cannot access the file 'C:\Users\rachelkang\maui1\src\Controls\samples\Controls.Sample\obj\staticwebassets.pack.sentinel' because it is being used by another process. Maui.Controls.Sample C:\Program Files\dotnet\sdk\6.0.300-preview.22154.4\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets 429

@mattleibow
Copy link
Member Author

This is what shows up in the error list: Error MSB3491 Could not write lines to file "obj\staticwebassets.pack.sentinel". The process cannot access the file 'C:\Users\rachelkang\maui1\src\Controls\samples\Controls.Sample\obj\staticwebassets.pack.sentinel' because it is being used by another process. Maui.Controls.Sample C:\Program Files\dotnet\sdk\6.0.300-preview.22154.4\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets 429

Ah yeah, this is a known issue in our repo. Just run again and the next time should work. I think we have some build tasks that are running in the background so they conflict.

Copy link
Member

@rachelkang rachelkang left a comment

Choose a reason for hiding this comment

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

LGTM and building happily now!

@mattleibow mattleibow merged commit 4fd18bf into main Apr 22, 2022
@mattleibow mattleibow deleted the dev/windows branch April 22, 2022 19:59
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@Eilon Eilon added the t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Application.Current.Windows maintains incorrect count
4 participants