question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WinUI3 apps close after showing the splash screen when launched with an executionAlias

See original GitHub issue

Describe the bug

If a WinUI3 app is launched with an execution alias the app starts but automatically closes after briefly showing the splash screen.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Create a new, empty WinUI3 desktop app from the VSIX template (version 3.0.0.2007130)
  2. Add the following to package.appxmanifest as a child of the App element.
        <Extensions>
            <uap5:Extension
                Category="windows.appExecutionAlias"
                Executable="$targetnametoken$.exe"
                EntryPoint="$targetentrypoint$">
                <uap5:AppExecutionAlias>
                    <uap5:ExecutionAlias Alias="MyTestApp.exe" />
                </uap5:AppExecutionAlias>
            </uap5:Extension>
        </Extensions>

(If using a UWP app set the EntryPoint as {AppName}.App)

  1. Add the XML Namespace alias xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
  2. Run the app from VS to deploy it locally
  3. Run the app from the command line c:\> MyTestApp.exe

Expected behavior

App should launch without issue

Screenshots

Version Info

NuGet package version: Microsoft.WinUI 3.0.0-preview2.200713.0

Windows app type:

UWP Win32
Yes Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

If in a WinUI3 UWP app, setting the Start action as “Do not launch, but debug my code when it starts” and adding a break point in the App Constructor , the break point is never hit. (I don’t know how to test the equivalent in a desktop app–or if it’s possible)

The error code/level after unsuccessfully launching an app from an alias is reported as 0. This is a success error code and so is misleading.

The same/equivalent functionality works fine for a pre-WinUI3/regular UWP app.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
mrlaceycommented, Nov 23, 2020

Without this functionality it is not possible to pass command-line arguments to apps. While “Desktop” apps are being equated with “Win32” apps I feel the lack of command-line support is a big gap.

Currently this issue isn’t even mentioned on the roadmap. With the GA release planned for H12021 and quarterly point releases after that, it looks as if command line support won’t be available until at least Q4 2021.

This is a serious blocker for allowing WinUI3 apps from integrating with existing apps.

1reaction
BorzillaRcommented, Mar 26, 2021

@mrlacey, I agree with you. This issue is not related to the original subject. The reason, I decided that it does not work, was I use the Power Shell console in my daily work. I could not imagine that the command line console would work better than Power Shell ))))

Anyway, it is strange that I can execute winver.exe from the Power Shell (whether by its name or by Start-Process) but I cannot execute MyDesktopTest.exe the same way. Another strange thing, when I type the command, which does not exist, I see a specific error in the response, but when I type MyDesktopTest.exe, there is no response. Looks like the app is launched but silently crashes.

screen1

In the command line, all work as expected.

screen2

And thank you @mrlacey for the precise and clear instructions. It was very helpful for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[UWP] App crashing on splash screen - Microsoft Q&A
For some users my app shows the splash screen for a second and than crashes. For most user it works. I have no...
Read more >
3
Describe the bug If a WinUI3 app is launched with an execution alias the app starts but automatically closes after briefly showing the...
Read more >
Windows 10 UWP app closes/crashes immediately after ...
The app is available in the start menu and can be started, but I only see the splash screen for some seconds and...
Read more >
Apps won't launch: Splash screen opens then closes
The main cause of my problem was Avast, which was closing the apps as soon as they opened. If you have this issue,...
Read more >
Is there a way to show a custom splash screen AND ...
I would like to temporarily show a blank/black screen or custom splash image AND disable all user input upon login UNTIL a desired...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found