ObservableCollection does not work for Microsoft Store version while working for debug version

Hong 1,661 Reputation points
2026-09-11T00:59:55.15+00:00

The following code is solely for debugging.

Xaml:

        <ListView x:Name="listViewTest"/>

C#:

                var folders = new ObservableCollection<string>
                    {
                        "OBS 1",
                        "OBS 2",
                        "OBS 3"
                    };

                listViewTest.ItemsSource = folders;

This works exactly as expected if the WinUI app is started from VS2026, but the store version built by VS2026 shows nothing.

The following works for both the debug version and the store version:

                var folders = new c<string>
                    {
                        "OBS 1",
                        "OBS 2",
                        "OBS 3"
                    };

                listViewTest.ItemsSource = folders.ToList();

My app has a slightly complex list, and it works flawlessly with the debug version, but not with the store version. It took me many hours to narrow it down to ObservableCollection.

Could anyone shed some light on this?

User's image

Windows development | WinUI
0 comments No comments

Answer accepted by question author
Jay Pham (WICLOUD CORPORATION) 4,680 Reputation points Microsoft External Staff Moderator
2026-09-16T07:31:01.34+00:00

Hi @Hong

Thank you for providing the additional information, call stack, and clarification about the use of ToList().

The available evidence does not yet confirm that ObservableCollection itself is the root cause. The exception is a native access violation followed by a fail-fast in Microsoft.UI.Xaml, while the supplied call stack contains only unresolved native addresses.

However, I tested the shared App1 project and found the following workaround while keeping the original ObservableCollection code unchanged.

I added these properties to the project file:


<PropertyGroup>

  <WindowsPackageType>None</WindowsPackageType>

  <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>

  <EnableMsixTooling>true</EnableMsixTooling>

  <PublishTrimmed>false</PublishTrimmed>

</PropertyGroup>

I then deleted the existing bin and obj directories and generated a fresh Release x64 publish. With this configuration, the application remained open and responsive, and the ListView displayed the original ObservableCollection without converting it to a List.

Disabling PublishTrimmed alone did not resolve the issue in my test. Adding only the Windows App SDK deployment properties also did not resolve it. The application worked when both changes were applied together.

Microsoft documents that .NET self-contained deployment and Windows App SDK self-contained deployment require separate configuration:

Windows App SDK deployment guide for self-contained apps

A similar published WinUI failure with exception code 0xC000027B was resolved using these Windows App SDK deployment properties:

WinUI 3 published unpackaged self-contained app crashes immediately

Please note that WindowsPackageType=None applies to the unpackaged App1 project you shared. I suggest testing this workaround in the same minimal project first. The Microsoft Store project's packaged configuration should be reviewed separately before applying this property to production.

Please let me know whether the newly published App1 build works with this combined configuration.

If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. 

Thank you. 

Was this answer helpful?

2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Jay Pham (WICLOUD CORPORATION) 4,680 Reputation points Microsoft External Staff Moderator
    2026-09-11T01:39:07.99+00:00

    I am working the issue and will provide an update soon. Thank you for your patience.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.