Share via

StorageProviderSyncRootManager.Unregister sync root not unregistering on uninstallation

Kai DeLorenzo 0 Reputation points
2025-09-10T19:34:20.1833333+00:00

https://learn.microsoft.com/en-us/uwp/api/windows.storage.provider.storageprovidersyncrootmanager.unregister

this site states

Packaged desktop apps do not need to call this method on uninstall, because the sync root will be automatically unregistered by the OS.

However, I can't seem to get this to work. Whenever I uninstall my app, the sync root registration remains. I'm packaging my app with MSIX. I don't know of a way to run unregistration code during uninstallation. This seems like how it's supposed to work; however, it never does. Does anyone have successful experience having the sync root cleaned up on app uninstallation?

Windows development | Windows App SDK

2 answers

Sort by: Most helpful
  1. Anonymous
    2025-09-11T08:51:29.0766667+00:00

    Hi @Kai DeLorenzo , thank for reaching out on Microsoft Q&A!

    You are right, this behavior is related to a known documentation gap that was discussed 6 years ago in Github: https://github.com/MicrosoftDocs/winrt-api/issues/1130

    In practice, there are scenarios where auto-cleanup does not occur, leaving behind Shell Namespace entries or registry keys. This often happens when Register() previously failed or partially succeeded, the app was installed/uninstalled in mixed contexts (e.g., MSIX + unpackaged dev builds), or certain registry entries under SyncRootManager or NameSpace were created but not removed.

    If it failed or the uninstall process didn’t trigger cleanup, you may need to manually remove leftover registry keys:

    • HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\<NamespaceCLSID>
    • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager\<SyncRootId>
    • HKCR\CLSID\<NamespaceCLSID> or HKCU\Software\Classes\CLSID\<NamespaceCLSID>
    • ...

    I hope my answer is useful to you! Thank you!

    Was this answer helpful?

    0 comments No comments

  2. Kai DeLorenzo 0 Reputation points
    2025-09-10T20:52:37.95+00:00

    Ok I figured out the answer. I would imagine this is likely a bug. The registration should fail unless

    this is in the Extension section:

    <desktop3:Extension Category="windows.cloudFiles">
    	<desktop3:CloudFiles>
    	</desktop3:CloudFiles>
    </desktop3:Extension>
    

    however it succeeds but then shows the issues I described above where the sync root will stay registered after uninstallation. additionally it will make it so the sync root does not seem to exist after the initial registering process exits (can't find it on future launches). however it's still visible in the registry and in file explorer.

    this will likely be encountered very rarely for production because all apps will provide com handlers (and therefor have the cloud files extension). i just hadn't gotten there yet because i was stuck trying to get simple registration working.

    Was this answer helpful?

    0 comments No comments

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.