Exception: 'The file is not a cloud file'
Hi,
I encountered an issue while running the code to register a sync root using StorageProviderSyncRootManager.Register(storageInfo); in Registrar.cs line 336. The exception thrown is:
System.Exception: 'The file is not a cloud file. (Exception from HRESULT: 0x80070178)'
Steps Taken:
Verified that the folder exists and has the correct permissions.
Ran the application with administrative privileges.
Any insights or suggestions to resolve this issue would be greatly appreciated.
Thank you
The line 336 in Registrar.cs is the call to
ValidateStorageProviderSyncRootInfo()
It does not look like this line can throw this exception.
Could you please provide:
- The exception stack trace.
- The version of the Engine that you are running.
- Sample name that we can use to reproduce this issue.
- .NET version.
- Windows version.
I can guess that there is something wrong with the folder that you are using. Please try any other folder to check.
Typically your folder will be somewhere under the C:\Users<user>\ folder. This location has necessary permissions by default and this is where OneDrive and SharePoint mount their root folder.
Please note that admin permissions are not required when registering. Typically you will install the application, register root and run your application with a regular user permissions, which provides higher security.
Please also note that our sample applications elevate permissions only to install the developer certificate, for demo purposes only. The root registration is done with a regular user rights in our samples.
Yes, it worked directly on the C drive only. OneDrive worked on C:\Users\<user>\ folder, but StorageProviderSyncRootManager.Register(storageInfo) only worked for folders directly placed under the C drive.
Unfortunately we were unable to reproduce the issue that you describe. Please provide:
- The exception stack trace.
- The version of the Engine that you are running.
- Sample name that we can use to reproduce this issue.
- .NET version.
- Windows version.
- Log file.
I can also guess that localization (OS language) may be causing this issue. We have recently seen issues with C:\Users<user>\ with some localizations on Windows 10 machines.
please find below the requested information:
-
Exception stacktrace:
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr) at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) at ABI.Windows.Storage.Provider.IStorageProviderSyncRootManagerStaticsMethods.Register(IObjectReference _obj, StorageProviderSyncRootInfo syncRootInformation) at Windows.Storage.Provider.StorageProviderSyncRootManager.Register(StorageProviderSyncRootInfo syncRootInformation) at ITHit.FileSystem.Samples.Common.Windows.Registrar.<RegisterAsync>d__9.MoveNext() in C:\Users\myuser\Desktop\UserFileSystemSamples-master\Windows\Common\Core\Registrar.cs:line 338 at ITHit.FileSystem.Samples.Common.Windows.Registrar.<RegisterSyncRootAsync>d__3.MoveNext() in C:\Users\myuser\Desktop\UserFileSystemSamples-master\Windows\Common\Core\Registrar.cs:line 63 at VirtualFileSystem.Program.<Main>d__7.MoveNext() in C:\Users\myuser\Desktop\UserFileSystemSamples-master\Windows\VirtualFileSystem\Program.cs:line 75 -
Engine version: 8.1.26901.0
-
.NET version: .NET 8.0.7 64bit
-
Windows version: Microsoft Windows 11 Pro, Version: 23H2, OS build: 22631.3880. (VirtualFileSystem project output is showing windows 10 instead of 11)
-
Sample name: i am running the cloned project from this repo, project name: VirtualFileSystem
-
Logs: app.log