RegistryWriteVirtualization does not work with the new syntax on Windows 10 supported versions
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
- Create a WASDK packaged app
- Specify the needed capabilities to write in the registry using the new syntax
- Run the app as administrator
- Try to write something in the registry
- Check the registry using Registry Editor to see that the value is not there
- Change it to the old syntax
- Try to write in the registry again
- Check the registry using Registry Editor to find the value there
You can download my full repro example.
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
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 no, that's exactly the set version I use in my app and I think also in the repro example.
@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 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.
@andreww-msft could you take a look?
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.