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

Restart API not working with unpackaged apps in 1.1.3 #2792

Closed
Balkoth opened this issue Jul 27, 2022 · 28 comments
Closed

Restart API not working with unpackaged apps in 1.1.3 #2792

Balkoth opened this issue Jul 27, 2022 · 28 comments
Assignees

Comments

@Balkoth
Copy link

Balkoth commented Jul 27, 2022

Describe the bug

Official documents https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/stable-channel#app-lifecycle--restart mention this should work for packaged and unpackaged apps, but using
Microsoft.Windows.AppLifecycle.AppInstance.Restart("");
as described here https://github.com/microsoft/WindowsAppSDK/blob/main/specs/AppLifecycle/Restart/restartApi.markdown#new-api
just crashes the app.

Steps to reproduce the bug

Just use this sample to verify:
TestRestartManager.zip

Expected behavior

No response

Screenshots

No response

NuGet package version

1.1.3

Packaging type

Unpackaged

Windows version

Windows 10 version 21H2 (19044, November 2021 Update)

IDE

Visual Studio 2022

Additional context

No response

@Balkoth
Copy link
Author

Balkoth commented Jul 27, 2022

It just crashes the whole application without getting a chance to debug even with native debugging enabled and all exceptions checked.

Once <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> is set on the project you get a file not found exception. Turns out that RestartAgent.exe is not distributed:
image

@AdamBraden AdamBraden self-assigned this Jul 29, 2022
@kanismohammed
Copy link

@Balkoth thanks for providing the feedback. We will take a look at the issue and keep you posted on the updates

@mikebattista
Copy link

With Template Studio 5.2 using 1.1.3, Restart("") works fine for me for both packaged and unpackaged projects. I do see a failure though when switching to self-contained. I get FileNotFound exceptions from the API which I assume is referring to RestartAgent.exe that you shared above.

@mikebattista
Copy link

https://task.ms/40728649

@Balkoth
Copy link
Author

Balkoth commented Aug 2, 2022

I can not confirm your observations. The attached sample was created with Template Studio 5.2 and does not ever restart. I can not find any relevant information on how to diagnose why. Eventlog does not show anything related in the Application log nor the AppLocker log.

TSRestartManagerTest.zip

@mikebattista
Copy link

My next guess would be that it's a downlevel problem since you're on 19044. @kanismohammed are these APIs supported downlevel?

@kanismohammed
Copy link

My next guess would be that it's a downlevel problem since you're on 19044. @kanismohammed are these APIs supported downlevel?

@dhoehna - Can you please take a look?

@dhoehna
Copy link
Contributor

dhoehna commented Aug 2, 2022

It was already answered here: #2792 (comment)

The restart agent isn't being included when WASDK is self-contained.

@dhoehna
Copy link
Contributor

dhoehna commented Aug 2, 2022

I can work on getting the restart agent to deploy with everything else.

@mikebattista
Copy link

mikebattista commented Aug 2, 2022

Thanks. There are two issues though. The self-contained issue is one. It's also possible the Restart API doesn't work for unpackaged apps downlevel. We need to investigate.

@Balkoth
Copy link
Author

Balkoth commented Aug 9, 2022

Is there some more investigation ongoing or will this just be buried like all other bug reports?

@dhoehna
Copy link
Contributor

dhoehna commented Aug 9, 2022

I'm looking into it. Progress has been slow, that's all.

@dhoehna
Copy link
Contributor

dhoehna commented Aug 29, 2022

Sorry for the gap in communication. I'm reporting in that I did find the root cause of the issue.

The root cause of the issue is in the OS code. More research is needed to figure out where a fix should go. Most likely Windows App SDK.

Again, sorry for the delay in communication. It took a bit longer than expected to hunt down this issue.

@mikebattista We might need to add internal hours to find a fix for this issue.
@kanismohammed FYI.

@mikebattista
Copy link

@dhoehna I've already filed https://task.ms/40728649. Do we need another bug?

@dhoehna
Copy link
Contributor

dhoehna commented Sep 14, 2022

Alrighty. Updating this. Sorry it took so long. The bug was deeper than I though.

This is a platform issue in VB. The ACLs on the folder in Windows Apps is Low IL. What this means is, even if the parent app is medium-IL, any process made in the frameworks folder, for example, RestartAgent.exe, "...\windowsapps[Fwp]\RestartAgent.exe" is lowIL.

Since restartAgent.exe creates the same process that was restarted, and, new processes inherit the parent processes IL, that means, the new process is also LowIL.

Now I'll be talking with peeps to figure out "What do we do about this and how do we fix it."

Again, sorry this is taking so long. I'm still working on it though.

@dhoehna
Copy link
Contributor

dhoehna commented Oct 19, 2022

The ACLs are being changed and should be serviced in February.

@Balkoth
Copy link
Author

Balkoth commented Dec 14, 2022

Will this also be fixed for unpackaged applications with <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> ?

@Balkoth
Copy link
Author

Balkoth commented Feb 27, 2023

Has this been serviced?

@appindus-ibiller
Copy link

The ACLs are being changed and should be serviced in February.

Is this fixed? If so what needs to be updated on our ends?

@dhoehna
Copy link
Contributor

dhoehna commented Mar 8, 2023

Sorry for the late reply. This change was serviced on February 2nd.

To get the correct ACLs for Windows App SDK please either

  1. Remove then add Windows App SDK, or
  2. Update Windows App SDK to a newer version.

Essentially the framework package needs to be removed, then installed.

@dhoehna
Copy link
Contributor

dhoehna commented Mar 8, 2023

I'm currently looking into a way to verify the fix is on a system so I can let ya'll know if the patch is present.

@appindus-ibiller
Copy link

@dhoehna Thanks for the reply! This will work for self-contained as well? Will we need to upgrade to 1.3 preview/wait for stable? or Will the WASDK's Feb release 1.2.4 suffice?

@Balkoth
Copy link
Author

Balkoth commented Mar 9, 2023

It is not fixed for self-contained apps as the original problem that RestartManager.exe is not distributed still persists.

@Balkoth
Copy link
Author

Balkoth commented May 15, 2023

Still not fixed in 1.3.1

@SlavDeV1991
Copy link

Any update on this?
I'm able to restart the C++ packaged app, but I'm unable to restart the unpackaged application.

@ivan-miracle
Copy link

ivan-miracle commented Jul 31, 2023

Is there any update on this issue? I have WindowsAppSDK 1.3.230724000 installed, and the problem is still there. My app is also an unpackaged application with WindowsAppSDKSelfContained enabled. Thanks.

@zhuxb711
Copy link

zhuxb711 commented Aug 2, 2023

It takes over one year and this issue is still there. Is that reasonable for WinUI team?

@AdamBraden
Copy link

The issue with RestartAgent.exe not being included in selfcontained apps is fixed in 1.4 preview 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants