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

Cannot run unpackaged Windows app - MAUI 6.04 #8186

Closed
mjfusa opened this issue Jun 20, 2022 · 5 comments
Closed

Cannot run unpackaged Windows app - MAUI 6.04 #8186

mjfusa opened this issue Jun 20, 2022 · 5 comments
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@mjfusa
Copy link

mjfusa commented Jun 20, 2022

Description

Attempting to run a Windows EXE when published as unpackaged results in crash with an access violation exception (0xc0000005).
Project MauiApp6.sln attached.
MauiApp6.zip

Steps to Reproduce

Use Visual Studio 2022 17.3.0 Preview 2.0 to Create MAUI 6.04 app (includes Windows App SDK 1.1).
On command line:
dotnet publish -f net6.0-windows10.0.19041.0 -c Release -p:WindowsPackageType=None
C:\p\MauiApp5\MauiApp5\bin\Release\net6.0-windows10.0.19041.0\win10-x64\publish\MauiApp.exe

Event Viewer:
Faulting application name: MauiApp6.exe, version: 1.0.0.0, time stamp: 0x62571213
Faulting module name: coreclr.dll, version: 6.0.522.21309, time stamp: 0x625708f4
Exception code: 0xc0000005
Fault offset: 0x00000000001cda03
Faulting process id: 0x7a68
Faulting application start time: 0x01d884ee41834e9b
Faulting application path: C:\p\MauiApp6\MauiApp6\bin\Release\net6.0-windows10.0.19041.0\win10-x64\publish\MauiApp6.exe
Faulting module path: C:\p\MauiApp6\MauiApp6\bin\Release\net6.0-windows10.0.19041.0\win10-x64\publish\coreclr.dll
Report Id: 7ebddae7-c7bf-4508-b031-16ac57a7035d
Faulting package full name:
Faulting package-relative application ID:

Version with bug

6.0.400 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10.0.19041.0

Did you find any workaround?

No

Relevant log output

No response

@mjfusa mjfusa added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jun 20, 2022
@MagicAndre1981
Copy link
Contributor

I get same on a new project and I it look I run into this issue from App SDK.

image

Looks like we need to wait for a new WindowsApp SDK update and merge into MAUI

@jfversluis
Copy link
Member

If you're not going through an MSIX, you will need to make sure yourself that all prerequisites are installed. Check that you have the WinAppSDK Runtime installed: https://docs.microsoft.com/windows/apps/windows-app-sdk/downloads

Then it works for me, apart from some bugs that still show up :)

@jfversluis jfversluis added s/needs-info Issue needs more info from the author area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jun 22, 2022
@ghost
Copy link

ghost commented Jun 22, 2022

Hi @mjfusa. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@AutumnEvans418
Copy link

AutumnEvans418 commented Jun 25, 2022

I am also having this issue even after installing windows-app-sdk. I am running the latest as well using blazor maui bindings and trying to run the exe from the publish folder and getting the same error. I downloaded both sdks (64x installers) and it did not make a difference.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jun 25, 2022
@mjfusa
Copy link
Author

mjfusa commented Jun 27, 2022

I was able to confirm that you can create an unpackaged (non-MSIX packaged) Windows app with the latest release of MAUI (6.0.4).
Here is the relevant documentation: Publish a .NET MAUI app for Windows - .NET MAUI | Microsoft Docs
Note that you’ll need to publish the app with the dotnet CLI, not in Visual Studio. For example:
In the project directory:
dotnet publish -f net6.0-windows10.0.19041.0 -c Release -p:WindowsPackageType=None

A couple of things I ran into and resolved:

  1. The app would not start after building the unpackaged build. Event Viewer showed 0xC0000005 (Access Denied). This was resolved by removing all preview versions of MAUI and the Windows App SDK. See here for instructions: Remove outdated Windows App SDK runtime versions from your development computer - Windows apps | Microsoft Docs
  2. The title bar of the Maui Windows app was disabled by default and consequently I could not resize, move, or close the app. I resolved this by turning off the .ExtendsContentIntoTitleBar flag in the MauiAppBuilder as follows:
public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
        builder
        .UseMauiApp<App>()
        .ConfigureLifecycleEvents(lifecycle =>
        {
#if WINDOWS
    lifecycle
    .AddWindows (windows => {
        _ = windows.OnWindowCreated ((window) => window.ExtendsContentIntoTitleBar = false);

    });
#endif
    })
    .ConfigureFonts(fonts =>
        {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
        });

    return builder.Build();
}

@mjfusa mjfusa closed this as completed Jun 27, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants