WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

RegistryWriteVirtualization does not work with the new syntax on Windows 10 supported versions

Open bogdan-patraucean opened this issue 3 years ago • 6 comments

Describe the bug

Trying to specify your app that it can write in the registry by disabling virtualization will only work with the old available syntax even if Windows 10 supports the new one.

the new syntax, introduced in Windows 10 (2004), build 19042

<virtualization:RegistryWriteVirtualization>

    <!-- Child elements -->
    virtualization:ExcludedKeys

</virtualization:RegistryWriteVirtualization>

the old syntax that worked prior to Windows 10 (2004)

<desktop6:RegistryWriteVirtualization>disabled</desktop6:RegistryWriteVirtualization>

Running an app on Windows 10 20H2 or more recent versions will ignore the new syntax and it will start to write in the virtualized Registry. The only way it works is by using the old syntax which should no longer be supported. The old syntax also works on Windows 11.

The information is written in the documentation.

If an application includes both syntaxes for disabling file system virtualization, the old declaration will be used on pre-2004 OS versions while the new declaration will be used on 2004 and later OS versions.

This is false as the new declaration is not used.

Steps to reproduce the bug

  1. Create a WASDK packaged app
  2. Specify the needed capabilities to write in the registry using the new syntax
  3. Run the app as administrator
  4. Try to write something in the registry
  5. Check the registry using Registry Editor to see that the value is not there
  6. Change it to the old syntax
  7. Try to write in the registry again
  8. Check the registry using Registry Editor to find the value there

You can download my full repro example.

RegistryRepro.zip

Expected behavior

If it's a bug, I would expect that the new syntax should be supported on Windows 10 2004 and later, and that the information will be written in the unvirtualized Registry. If this is intended behaviour the documentation should be updated as people can spend a lot of time trying to understand what's wrong, considering the documentation says it should work.

Screenshots

No response

NuGet package version

Windows App SDK 1.2.2: 1.2.221209.1

Packaging type

Packaged (MSIX)

Windows version

Windows 10 version 22H2 (19045, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

bogdan-patraucean avatar Jan 27 '23 11:01 bogdan-patraucean

Out of curiosity, what is the minimum targeted version in the appxmanifest file? If you set the minimum version to 10.0.19041.0, does the new syntax work?

DarranRowe avatar Jan 29 '23 20:01 DarranRowe

@DarranRowe no, that's exactly the set version I use in my app and I think also in the repro example.

bogdan-patraucean avatar Jan 29 '23 22:01 bogdan-patraucean

@bogdan-patraucean Your repro sets that as the target version, not the minimum version. What I mean here is, for example

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.19041.0" />
  </Dependencies>

In the package.appxmanifest file. Your reproduction has:

	<Dependencies>
		<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
	</Dependencies>

Notice how the MinVersion states that 10.0.17763.0 is the minimum version supported?

DarranRowe avatar Jan 30 '23 00:01 DarranRowe

@DarranRowe yes, I could not check the repro when I wrote the message, but in my app I have this set. I also tested the repro with MinVersion set to 10.0.19041.0 and it's the same issue. I updated the repro with it to reflect that.

bogdan-patraucean avatar Jan 30 '23 08:01 bogdan-patraucean

@andreww-msft could you take a look?

gabbybilka avatar Feb 02 '23 17:02 gabbybilka

The same problem seems to affect FileWriteVirtualization in Windows 10 22H2, namely that having both syntaxes will trigger the old one (completely disabling virtualization) and ignore the new one, the exact opposite of what the documentation says. If this behavior did work in Windows 10 2004, this is likely a regression.

leo-hydraulic avatar Nov 15 '23 18:11 leo-hydraulic