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

Unpackaged C++ sample app MddBootstrapInitialize call reports unhandled exception in KernelBase.dll #2138

Closed
dhull-aptos-com opened this issue Feb 19, 2022 · 9 comments · Fixed by #2316
Assignees
Labels
area-Deployment Issues related to packaging, installation, runtime (e.g., SelfContained, Unpackaged) bug Something isn't working Status: In PR

Comments

@dhull-aptos-com
Copy link

Describe the bug

I ran WindowsAppRuntimeInstall.exe from Microsoft.WindowsAppRuntime.Redist.1.0.0.
I followed the tutorial for creating the DynamicDependenciesTest unpackaged C++ app.
When I run the app I receive an unhandled exception at 0x0000uFFFC4F9B382 (KernelBase.dll) when the MddBootstrapInitialize function is called.

If I do this same thing on a different computer it runs without problems.

I had previously been developing a WindowsAppSDK 1.0 packaged app and that was working just fine. I tried uninstalling the runtime, uninstalling all packaged apps, then reinstalling the runtime and that doesn't help.

The computer where it is failing is running Windows 10 Enterprise 20H2 OS build 19042.1526.

I have attached screenshots of the source code and error and call stack when single-stepping in the debugger.

Steps to reproduce the bug

  1. Run WindowsAppRuntimeInstall.exe from Microsoft.WindowsAppRuntime.Redist.1.0.0.
  2. Create the DynamicDependenciesTest following the tutorial at https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/tutorial-unpackaged-deployment?tabs=cpp
  3. Run DynamicDependenciesTest.exe

Expected behavior

No response

Screenshots

Screenshot showing source code with the unhandled exception message:
SourceCodeWithException

Screenshot showing the call stack when the exception was reported:

Callstack

NuGet package version

1.0.0

Packaging type

Unpackaged

Windows version

Windows 10 version 20H2 (19042, October 2020 Update)

IDE

Visual Studio 2019

Additional context

No response

@BenJKuhn BenJKuhn added area-Deployment Issues related to packaging, installation, runtime (e.g., SelfContained, Unpackaged) bug Something isn't working labels Feb 22, 2022
@asklar
Copy link
Member

asklar commented Feb 27, 2022

@vrodaxAptos I ran into this as well, and it took me a lot longer to figure out what was happening than it should have.

In my case, I was missing the installation of the Dynamic Dependencies Lifetime Manager package (DDLM).
Therefore when WinAppSDK tried to get the list of app extensions, it had nothing.

You can get it from the prerequisites page: https://docs.microsoft.com/windows/apps/windows-app-sdk/deploy-unpackaged-apps#prerequisites

We should probably update the docs for MddBootstrapInitialize to point to this too, and provide a better error message (or at least debug output).

@DrusTheAxe
Copy link
Member

In my case, I was missing the installation of the Dynamic Dependencies Lifetime Manager package (DDLM).

Can you elaborate?

If you run WindowsAppRuntimeInstall.exe this shouldn't be a problem. That installs all applicable packages1. If you ran the installer did it encounter a problem?

1 What's applicable depends on the system's cpu:

  • x86 machine: x86 framework, x86 main, x86 singleton, x86 ddlm
  • x64 machine: x86+x64 framework, x64 main, x64 singleton, x86+x64 ddlm
  • arm64 machine: x86+x64+arm64 framework, x64 main, x64 singleton, x86+x64+arm64 ddlm

If you install packages yourself (don't use the installer) then you need to do the equivalent to the installer.

If you hit F5 in VS for a packaged app that only registers 1 framework package (matching your project's target); if you're a packaged app you can call DeploymentManager.Initialize() spec'd here to get the main+singleton packages registered (the DDLM's only needed by unpacckaged apps). More docs here.

If you hit F5 in VS for an unpackaged app it doesn't register any package. Unpackaged apps built with WinAppSDK have a prereq to install the packages. This isn't integrated into VS' build system today. It's on our radar as something we'd like to support in the future (https://task.ms/33356079). If you're an unpackaged app you need to install the packages on your dev machine. The installer is a convenient way to do that.

Detailed deployment guides at...

@DrusTheAxe
Copy link
Member

provide a better error message (or at least debug output).

It's in my queue :-)

@asklar
Copy link
Member

asklar commented Feb 27, 2022

In my case, I was missing the installation of the Dynamic Dependencies Lifetime Manager package (DDLM).

Can you elaborate?

If you run WindowsAppRuntimeInstall.exe this shouldn't be a problem. That installs all applicable packages1. If you ran the installer did it encounter a problem?

1 What's applicable depends on the system's cpu:

  • x86 machine: x86 framework, x86 main, x86 singleton, x86 ddlm
  • x64 machine: x86+x64 framework, x64 main, x64 singleton, x86+x64 ddlm
  • arm64 machine: x86+x64+arm64 framework, x64 main, x64 singleton, x86+x64+arm64 ddlm

If you install packages yourself (don't use the installer) then you need to do the equivalent to the installer.

If you hit F5 in VS for a packaged app that only registers 1 framework package (matching your project's target); if you're a packaged app you can call DeploymentManager.Initialize() spec'd here to get the main+singleton packages registered (the DDLM's only needed by unpacckaged apps). More docs here.

If you hit F5 in VS for an unpackaged app it doesn't register any package. Unpackaged apps built with WinAppSDK have a prereq to install the packages. This isn't integrated into VS' build system today. It's on our radar as something we'd like to support in the future (https://task.ms/33356079). If you're an unpackaged app you need to install the packages on your dev machine. The installer is a convenient way to do that.

Detailed deployment guides at...

@DrusTheAxe unfortunately your expectations that I/other people would read all the docs (or fully understand winappsdk packaging...) before trying to code, is misplaced :)

Yes, there is a deployment guide. It has a link to prerequisites, etc. However that is not the starting point for me, I start with the code. The API docs for MddBootstrapInitialize don't mention any of this, but they should.
I had not run the installer, I didn't even know there was an installer, I thought calling the API would just do whatever is needed to get winappsdk working for my app. If there needs to be a bootstrap package installed, I would have expected that calling the API would have downloaded and installed it on demand, but that's not the case apparently.

While debugging this I also discovered some bugs in the winappsdk docs, I'll send mail internally about it.

Bottom line is we should not assume people read our non-code documentation (esp longer docs) and we should make our APIs work more naturally.

@DrusTheAxe
Copy link
Member

unfortunately your expectations that I/other people would read all the docs

Snicker. I never said that. I merely noted they exist. Devs are notoriously happy to JustDoIt and maybe read docs later if ever (and I'm no exception :P)

The API docs for MddBootstrapInitialize don't mention any of this, but they should...
...I didn't even know there was an installer...

Good feedback. Will follow up.

@angelazhangmsft @cwruss @AdamBraden @sachintaMSFT for visibility

I also discovered some bugs in the winappsdk docs, I'll send mail internally about it.

Best way to get something on the radar is to file bugs here or in ADO (if you have access). Thanks!

@dhull-aptos-com
Copy link
Author

dhull-aptos-com commented Feb 28, 2022

@DrusTheAxe
I installed the pre-requisite files in the order that they are specified at: https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/deploy-unpackaged-apps#prerequisites

I checked under Apps and features and found that the DDLM was installed. I have included a screenshot:

image

I see errors in the Microsoft-Windows-AppxDeploymentServer/Operational event log at 2/27/2022 6:08:01 PM EST. I am attaching a copy of these log files:
AppXEventLogs.zip

The errors in the file appear to indicate that there are files that are missing.

@riverar
Copy link
Contributor

riverar commented Feb 28, 2022

While debugging this I also discovered some bugs in the winappsdk docs, I'll send mail internally about it.

@asklar
Can you please file those in the repository where the docs live, so we can be aware of these issues too? https://github.com/MicrosoftDocs/windows-uwp/issues

@DrusTheAxe DrusTheAxe linked a pull request Mar 29, 2022 that will close this issue
@DrusTheAxe
Copy link
Member

Docs have been updated

There's also more diagnostic info coming in 1.1 (#2316)

@asklar
Copy link
Member

asklar commented Apr 1, 2022

thanks Howard!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Deployment Issues related to packaging, installation, runtime (e.g., SelfContained, Unpackaged) bug Something isn't working Status: In PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants