-
Notifications
You must be signed in to change notification settings - Fork 665
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
WinUI3 apps close after showing the splash screen when launched with an executionAlias #3441
Comments
For the desktop app, I've also tried overriding the |
Without this functionality it is not possible to pass command-line arguments to apps. 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. |
I can still repro this in Preview 4. |
@mrlacey I made it work using the uap3: <Package
...
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
...
IgnorableNamespaces="uap rescap uap3">
<Extensions>
<uap3:Extension
Category="windows.appExecutionAlias"
EntryPoint="Windows.FullTrustApplication">
<uap3:AppExecutionAlias>
<desktop:ExecutionAlias Alias="MyTest.exe" />
</uap3:AppExecutionAlias>
</uap3:Extension>
</Extensions> This is the link to the doc Let me know if this works on your side. |
@marb2000 I can confirm that I can now get this working for both UWP and Desktop apps with Preview 4. (My repro above is incomplete 😢 and I can't find my original exploratory projects so I don't know if it was me or if it has been fixed.) Both work with Here's how I got it working in a WinUI3 UWP app.
<Extensions>
<uap5:Extension
Category="windows.appExecutionAlias"
Executable="App231.exe"
EntryPoint="App231.App">
<uap5:AppExecutionAlias>
<uap5:ExecutionAlias Alias="MyTest.exe" />
</uap5:AppExecutionAlias>
</uap5:Extension>
</Extensions> OR use xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
...
<Extensions>
<uap3:Extension
Category="windows.appExecutionAlias"
Executable="App231.exe"
EntryPoint="App231.App">
<uap3:AppExecutionAlias>
<desktop:ExecutionAlias Alias="MyTest.exe" />
</uap3:AppExecutionAlias>
</uap3:Extension>
</Extensions> (where "App231" is the name of the app/project and "MyTest.exe" is the alias to use to launch the app.)
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
{
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Window.Current.Content = rootFrame;
}
rootFrame.Navigate(typeof(MainPage));
Window.Current.Activate();
} Here's how I got it working in a WinUI Desktop app:
protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);
if (args.Kind == ActivationKind.CommandLineLaunch)
{
m_window = new MainWindow();
m_window.Activate();
}
}
<Extensions>
<uap5:Extension
Category="windows.appExecutionAlias"
EntryPoint="Windows.FullTrustApplication">
<uap5:AppExecutionAlias>
<uap5:ExecutionAlias Alias="MyDesktopTest.exe" />
</uap5:AppExecutionAlias>
</uap5:Extension>
</Extensions> (where "MyDesktopTest.exe" is the alias to use to launch the app.) Important points of note:
|
Hello! Windows 20H2 (OS Build 19042.867) |
@mrlacey does your solution work with ProjectReunion? |
@StephenLPeters I've just run through my steps above and I can confirm that they work for me with the ProjectReunion0.5-preview packages and templates. It would be nice if WinUI had an automated test to verify this functionality, rather than rely on manual testing for regressions ;) |
Yes, totally agree! @kmahone and @Austin-Lamb . Thanks for confirming that :) @BorzillaR do you want to take a closer look or provide more info about your scenario? |
@StephenLPeters, I ran my app in the power shell. Now I launch it though the command prompt and it successfully showed. Should I use a different syntax to run my app through the power shell? |
@BorzillaR you have to have run the app at elast once before being able to launch from the alias. Is that the issue you were having? |
@mrlacey, no, I am talking about another issue. After the first run I do the following steps Open a command line. Then open a Power Shell window. Thats the issue. |
@BorzillaR this looks to be a PowerShell specific issue and not at all related to the issue originally reported here. Just typing In theory using the call operator (&) should work e.g. However, using Process-Start does work to launch an application from an alias e.g. Hopefully this unblocks you. |
@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. In the command line, all work as expected. And thank you @mrlacey for the precise and clear instructions. It was very helpful for me. |
Could you elaborate a bit more on this? |
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:
package.appxmanifest
as a child of theApp
element.(If using a UWP app set the EntryPoint as
{AppName}.App
)xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
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:
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.
The text was updated successfully, but these errors were encountered: