My program is writing to a SqlServerCe file located at C:\ProgramData\MyApp\MyDb.sdf
.
For development I've made my account the owner of C:\ProgramData\MyApp\
with write access.
Previously this has been working fine but today I got this error:
System.UnauthorizedAccessException: 'Access to the path 'C:\ProgramData\Microsoft.SqlServer.Compact.400.32.bc' is denied.'
With this stack trace
mscorlib.dll!System.IO.StreamWriter.StreamWriter(string path, bool append, System.Text.Encoding encoding, int bufferSize, bool checkHost) Unknown
mscorlib.dll!System.IO.StreamWriter.StreamWriter(string path, bool append, System.Text.Encoding encoding) Unknown
mscorlib.dll!System.IO.File.WriteAllLines(string path, string[] contents, System.Text.Encoding encoding) Unknown
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeServicing.DoBreadcrumbServicing(string modulePath) Unknown
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.NativeMethods.LoadNativeBinariesFromPrivateFolder(string privateInstall) Unknown
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries() Unknown
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeConnection.SqlCeConnection() Unknown
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeConnection.SqlCeConnection(string connectionString) Unknown
It appears that although SqlServerCe does try to write to 'C:\ProgramData\Microsoft.SqlServer.Compact.400.32.bc' failing to do so isn't a critical error.
The program could safely continue by pressing "Continue"/F5
The reason Visual Studio did break was this setting.