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

ResourceLoader crashes upon upgrading to 1.1.1 #2651

Closed
leduyquang753 opened this issue Jun 21, 2022 · 6 comments
Closed

ResourceLoader crashes upon upgrading to 1.1.1 #2651

leduyquang753 opened this issue Jun 21, 2022 · 6 comments

Comments

@leduyquang753
Copy link

leduyquang753 commented Jun 21, 2022

Describe the bug

With the default Windows app SDK version of 1.0.3 from the C++/WinRT WinUI 3 in desktop template, instantiating a ResourceLoader works and loads Strings/en-US/Resources.resw normally. After upgrading the SDK to 1.1.1, such an instantiation produces "an application internal exception" of impl::error_out_of_bounds and crashes the app.

Steps to reproduce the bug

  1. Create an unpackaged C++/WinRT WinUI 3 in desktop app.
  2. Create Strings/en-US/Resources.resw.
  3. Upgrade Windows app SDK NuGet package to 1.1.1.
  4. Insiantiate a ResourceLoader.
  5. Debug the app.

Expected behavior

The ResourceLoader is instantiated successfully and the app can proceed.

Screenshots

image
image

NuGet package version

1.1.1

Packaging type

Unpackaged

Windows version

Windows 11 version 21H2 (22000)

IDE

Visual Studio 2022

Additional context

No response

@riverar
Copy link
Contributor

riverar commented Jun 21, 2022

Do you have the 1.1.1 runtimes installed? Think this is just another manifestation of #2592.

@leduyquang753
Copy link
Author

leduyquang753 commented Jun 21, 2022

Do you have the 1.1.1 runtimes installed? Think this is just another manifestation of #2592.

I did go to great lengths to get the latest runtime packages to install successfully, the output showed it managed to load the runtime package and it did go into the app code until the line that instantiated the ResourceLoader was reached.

@riverar
Copy link
Contributor

riverar commented Jun 21, 2022

Ah ok. Can you zip up/attach your sample project? (just drop the zip into this issue)

@leduyquang753
Copy link
Author

SDKTest.zip

@leduyquang753
Copy link
Author

leduyquang753 commented Jun 22, 2022

I just found out about ResourceLoader::GetForViewIndependentUse but it also throws 0x00000004 "The system cannot open the file", if I change the project to packaged it works.

Looking around about this error reveals a resolved issue from the PowerToys team #2583, I will see if that reveals something I am missing.

@leduyquang753
Copy link
Author

Indeed what I missed was that I was using "system MRT" with a class name of winrt::Windows::ApplicationModel::Resources::ResourceLoader, after changing to using MRTCore's winrt::Microsoft::Windows::ApplicationModel::Resources::ResourceLoader it can now run. I would suggest giving this a mention somewhere in the documentation, unless it's already been done and I have also missed it. 😅

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

2 participants