Skip to content

Packaged wasdk app can't even read correct registry value? #5199

@HO-COOH

Description

@HO-COOH

Describe the bug

So I am using RegGetValue() to poll registry values. And when changes are made to the value, the polling result returned is completely unpredictable in wasdk packaged app

Steps to reproduce the bug

  1. Create a C++ winui3 packaged app (without a Windows application packaging project)
  2. Add this code in MainWindow.xaml constructor
        MainWindow()
        {
			std::thread{ [] {
				while (true)
				{
					DWORD value;
					DWORD size = sizeof(value);
					RegGetValueW(
						HKEY_CURRENT_USER,
						LR"(Software\Microsoft\Windows\DWM)",
						L"AccentColor",
						RRF_RT_REG_DWORD,
						nullptr,
						&value,
						&size
					);
					OutputDebugString(std::format(L"{}\n", value).data());
					Sleep(1000);
				}
			} }.detach();
        }
  1. Use the same code in a C++ console application project
  2. Build and run both, now go to windows personalization settings, change the accent color, observe the output from both. See how they diverge. Open up a regedit you can see the console application is returning the correct result.

Expected behavior

No response

Screenshots

Image

NuGet package version

Windows App SDK 1.6.3: 1.6.250108002

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2 (22621, October 2024 Update)

IDE

Visual Studio 2022

Additional context

At this point, I don't even know what to expect. I thought at least polling should work for me to workaround #4075

Repro

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions