Error while modifying/querying SQL Server Compact 4.0 SDF when UWF is activated on Windows 10 device

My C# application is built using .Net framework 4.6.1 which uses sdf database file from SQL Server compact 4.0. When it is installed in a folder that is not protected by UWF in Windows 10 device, it runs fine. But if it is installed under a folder that is UWF-protected, the application throws an error System.Data.SqlServer.Ce.SqlCeError with a message "The file resolves to a path that is too long. The maximum length is 260 characters."

What could be the reason for this error?

The same application runs fine if the sdf is from SQL Server Compact 3.5. But, we cannot move back to SQL 3.5. Can you please help me find the reason and provide a solution.

Thanks in advance
Kumari

Doubt this has anything to do with SQL Server.

Check this out (found this on SO)
https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file

The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the "\?" prefix. For example, "\?\D:\ very long path ".

Thanks Yosiasz for the quick response.

While debugging, I checked my data source path in the connection string, it is not more than 50 characters. But I still get the error 'file path too long' and that too only when UWF is activated.

Since I see problem only with SQL Server compact version 4.0 and not with 3.5, I chose this forum.
But as you rightly pointed out, I shall also check Windows 10 forums.

I am still stuck with this issue. Can anyone tell in what way the SQL server compact 4.0 database file (.sdf) is different from SQL Server Compact 3.5 especially with respect to Unified Write Filter?

Thanks in advance.