microsoft / microsoft/WindowsAppSDK

Upgrading to v1.8 breaks ResourceLoader in unpackaged apps

Open
#5,832 10 comments 3 reactions 0 assignees View on GitHub
area-Packaging needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

When updating from v1.7 to v1.8 my app ([DLSS Swapper](https://github.com/beeradmoore/dlss-swapper)) no longer launches. Constructing `Windows.ApplicationModel.Resources.ResourceLoader` causes the app to crash. There is a repro linked below.

The error appears to come from `WinRT.Runtime.dll` and is

> System.IO.FileNotFoundException: Unable to find the specified file.

The full stacktrace is,

> at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
> at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
> at ABI.WinRT.Interop.IActivationFactoryMethods.ActivateInstanceUnsafe(IObjectReference objectReference, Guid iid)
> at Windows.ApplicationModel.Resources.ResourceLoader..ctor()
> at ResourceLoaderTest.MainWindow.Grid_Loaded(Object sender, RoutedEventArgs e) in D:\git\beeradmoore\WindowsAppSDK_ResourceLoaderIssue\ResourceLoaderTest\ResourceLoaderTest\MainWindow.xaml.cs:line 37

I was not able to reproduce the issue in a packaged app.

Comparing the files in bin between the two I notice that v1.7 produces `resources.pri` whereas v1.8 produces `ResourceLoaderTest.pri`. If I put the app config in its broken state and confirm it does not work as intended, but then copy/paste `ResourceLoaderTest.pri` to `resources.pri` it will now work as expected.

### Steps to reproduce the bug

See the project in this repo: https://github.com/beeradmoore/WindowsAppSDK_ResourceLoaderIssue
1. Run the project in debug mode (runs as unpackaged by default).
2. Observe that the first `Debugger.Break();` is hit indicating `ResourceLoader` constructed
3. Update nuget package from 1.7.250606001 to 1.8.250907003
4. Run the project again and now observe you hit the `Debugger.Break();` in the catch statement.

### Expected behavior

The first `Debugger.Break();` is hit in both cases.

### Screenshots

_No response_

### NuGet package version

Windows App SDK 1.8.0: 1.8.250907003

### Packaging type

Unpackaged

### Windows version

Windows 11 version 24H2 (26100, June 2025 Update)

### IDE

Visual Studio 2022

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Use the linked WindowsAppSDK_ResourceLoaderIssue repro and start at ResourceLoaderTest/MainWindow.xaml.cs line 37, comparing the unpackaged output for package versions 1.7.250606001 and 1.8.250907003. Verify the differing resources.pri and ResourceLoaderTest.pri files and reproduce the failure in debug mode. Done means ResourceLoader constructs successfully in the unpackaged app after upgrading, matching the expected first Debugger.Break().

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.