File system operations through UAC fail until I use file explorer

83 views Asked by At

In Visual Studio, I have a package project referencing a uwp and a .NET 4.8 program.

The uwp app and the .NET framework program communicate via desktop bridge.

The manifest of the package declares the full trust capability.

The uwp app sends file system operations requests to the .NET program. These requests ask to perform operations like copy, move,delete or rename files and folders.

When performing operations on protected locations like the root of a hard drive, a windows dialog 'file access denied' asks user's permission.

Upon clicking yes, the uac dialog appears to ask for permission. Then, if I click yes in the dialog, nothing happens.

But if I then perform some similar operation on the same location with Windows' file explorer, and give my consent to the windows dialog it works without any uac prompt.

Then, I can return to my app, and when trying some file system operation, the same uac dialog appears, but the operation is successful every time.

The described behavior is the same regardless of the method used by the .NET framework (System.IO, VisualBasic.FileIO.FileSytem, various wrappers for SHFileoperation or IFileoperation, cmd.exe, Powershell, etc...)

To summarize, I need to use Windows' file explorer once, and then uac will let my app perform file system operations. The app should work without this workaround.

Has anyone experienced similar issues?

0

There are 0 answers