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 apps do not handle "win-x64" RuntimeIdentifier's correctly #20299

Open
BurkusCat opened this issue Feb 1, 2024 · 8 comments
Open

WinUI apps do not handle "win-x64" RuntimeIdentifier's correctly #20299

BurkusCat opened this issue Feb 1, 2024 · 8 comments
Assignees
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@BurkusCat
Copy link
Contributor

BurkusCat commented Feb 1, 2024

Description

This is possibly a regression. I previously (on MAUI 8.0.3 and NET 8.0.100) was able to produce a MAUI Windows packaged app (albeit with this bug #19763 ) that was able to launch on startup. This was using RID win10-x64. I cannot get a build to produce using win10-x64, presumably due to .NET updating or MAUI updating. I have not been successful in downgrading anything to get it working again.

However, I have been able to build using RID win-x64 which I think makes sense and is probably correct. This build does not start and crashes on launch. In my reproduction, I have build the "weathertwentyone" sample app using a GitHub actions pipeline following the documentation for how to build a packaged WinUI app (https://learn.microsoft.com/en-us/dotnet/maui/windows/deployment/publish-cli?view=net-maui-8.0). In my reproduction I have attached the build artifact and included the git tag of what the source used to build it was. You can look at the other tags or in the actions branch to see more things I tried.

I think a potential cause for the issue is that something now requires win-x64 as the RID, however, something has not been updated to properly handle that RID causing the build produced not to be runnable.

Steps to Reproduce

  1. Create a MAUI application
  2. Follow the guide to produce a pipeline that builds the app for Windows https://learn.microsoft.com/en-us/dotnet/maui/windows/deployment/publish-cli?view=net-maui-8.0 NOTE: win10-x64 has been replaced with win-x64 in my reproduction.

Link to public reproduction project repository

https://github.com/BurkusCat/maui-samples/releases/tag/windows%2F1.6.1

Version with bug

8.0.6

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.3

Affected platforms

Windows

Affected platform versions

Windows 11

Did you find any workaround?

No

Relevant log output

Log files when trying to start the app when I attach the Visual Studio debugger:
weather-twenty-one-log-packaged-self-contained.txt

@BurkusCat BurkusCat added the t/bug Something isn't working label Feb 1, 2024
@BurkusCat
Copy link
Contributor Author

I think this may also apply to unpackaged apps as well but I've tried to keep to the simplest case for this reproduction.

@samhouts samhouts added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Feb 1, 2024
@samhouts samhouts added platform/windows 🪟 area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) labels Feb 2, 2024
@BurkusCat
Copy link
Contributor Author

I tried doing a "Release" build in Visual Studio of an unpackaged WinUI app and the contents of the "win10x-64" folder did start when I ran the .exe (missing images + font resources however). Maybe this is more evidence that "win-x64" being used is now causing problems with publish?

Side note: I worked around the image/font issue by updating my csproj to be:

    <!-- Images -->
    <MauiImage Include="Resources\Images\*">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </MauiImage>

    <!-- Custom Fonts -->
    <MauiFont Include="Resources\Fonts\*">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </MauiFont>

@rmarinho rmarinho added this to the Backlog milestone Feb 2, 2024
@ghost
Copy link

ghost commented Feb 2, 2024

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@PureWeen
Copy link
Member

@BurkusCat does this relate to what you're seeing?
#20592 (comment)

@BurkusCat BurkusCat changed the title Simple, packaged WinUI MAUI app publishing fails to produce an app that can start WinUI apps do not handle "win-x64" RuntimeIdentifier's correctly Feb 22, 2024
@BurkusCat
Copy link
Contributor Author

@PureWeen I don't think that is what I have been seeing. I think my issues have been around the documentation around RuntimeIdentifier and RuntimeIdentifierOverride. I've added a comment related to that here on the docs-maui repo: dotnet/docs-maui#2056

I've created a PR on the "maui-samples" repo with examples of fully working WinUI packaged + unpackaged GitHub actions: dotnet/maui-samples#442

I think there are lot of potential traps to fall into that produce failed builds for one reason or the other. I think a few I fell into were around RuntimeIdentifier and win10-x64 and win-x64. You can see some attempts here that didn't work out: https://github.com/BurkusCat/maui-samples/tree/failed-actions

I've renamed this issue as I think the crux of the issue is the docs guide you to use win10-x64 as a runtime override but win-x64 appears to be the go-forward RID in .NET8 (which some compile errors point you to use instead), MAUI/WinUI doesn't appear to work with that RID. I think the doc issues I've raised will help solve the issues with the current version of MAUI.

However, I will leave this ticket open in case MAUI does need to make some changes to support win-x64 RIDs. Maybe MAUI can use win10-x64 forever or maybe it is something that needs preparation work to support win-x64?

@JochemPalmsens
Copy link

Well, crap, this was my issue when updating to .net 8.
We are using W2DGraphicsView from Microsoft.Maui.Graphics.Win2D.WinUI.Desktop. But if kept crashing on startup. Getting a "Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))" exception.

So to get it to work with .net 8, I had to revert the RID to win10-[...] and enable
<UseRidGraph>true</UseRidGraph> in the projects.

@PureWeen PureWeen modified the milestones: Backlog, .NET 9 Planning May 1, 2024
@wasker
Copy link

wasker commented May 8, 2024

This is unfortunate that the issue is put on .NET 9 backlog. .NET 8 is LTS and this behavior seems to be a recent regression, should really be fixed in .NET 8...

@kevinxufei
Copy link

Verified this issue with Visual Studio 17.11.0 Preview 2.1 (8.0.60). Can repro this issue.

@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed and removed potential-regression This issue described a possible regression on a currently supported version., verification pending labels Jun 21, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
@PureWeen PureWeen removed this from the .NET 9 Planning milestone Oct 17, 2024
@PureWeen PureWeen added this to the .NET 10 Planning milestone Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants