G
GilfordTan
I have a WPF based desktop application that made use of SQL Server Compact 4.0 with Entity Framework and LINQ. It has been working fine for a couple of years until recently some users have problems opening it as it keeps getting this exception.
Exception at outer most = System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCe.SqlCeException: Unspecified error [ sqlcese40.dll ]
at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.DbContextTransaction.EnsureOpenConnection()
at System.Data.Entity.DbContextTransaction..ctor(EntityConnection connection)
at System.Data.Entity.Database.BeginTransaction()
at Ecms.Utilities.DatabaseVersionHelper.UpdateToVersion(String database, Int32 version)
EXCEPTION: System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCe.SqlCeException: Unspecified error [ sqlcese40.dll ]
at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.DbContextTransaction.EnsureOpenConnection()
at System.Data.Entity.DbContextTransaction..ctor(EntityConnection connection)
at System.Data.Entity.Database.BeginTransaction()
at Ecms.Utilities.DatabaseVersionHelper.UpdateToVersion(String database, Int32 version)
It seems to occur whenever it creates a new instance of entity like the following code block.
using (var db = new MyEntity())
{
// Do something
}
It was created with "EF Designer from database" option as I add a new "ADO.NET Entity Data Model". I did try to use SQLite but I could never install it and make it work in Visual Studio Community 2015. I also looked at LocalDB but it seems that users have to install something extra along with my application in order to work which is what I'm trying to avoid.
I discovered that the problem arises when users do not have permissions to access AppData (Roaming) folder. I tested on a virtual machine with Windows 7. The app will work if the I have permissions to access AppData (Roaming) folder and vice versa.
However, when tested on a virtual machine with Windows 10, the app works fine regardless of whether I have permissions to access AppData (Roaming) folder or not.
Do note that my application does not make use of AppData (Roaming) folder deliberately. I suspect that however, some of the dependency libraries are using it and so far I could only determine that SQL Server Compact 4.0 is affected.
Also bear in mind that the affected users seem adamant on not changing access permission to the AppData (Roaming) folder.
Interestingly, I also discovered that some applications will not open when AppData (Roaming) folder is restricted such as Notepad++ and Skype.
Does anyone have similar experience? Why is this happening in Windows 7 and not Windows 10? Does AppData (Roaming) folder play a crucial role for many desktop applications to work? Is there a workaround?
Edit: Included the exception and its stack trace
Continue reading...
Exception at outer most = System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCe.SqlCeException: Unspecified error [ sqlcese40.dll ]
at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.DbContextTransaction.EnsureOpenConnection()
at System.Data.Entity.DbContextTransaction..ctor(EntityConnection connection)
at System.Data.Entity.Database.BeginTransaction()
at Ecms.Utilities.DatabaseVersionHelper.UpdateToVersion(String database, Int32 version)
EXCEPTION: System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCe.SqlCeException: Unspecified error [ sqlcese40.dll ]
at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.DbContextTransaction.EnsureOpenConnection()
at System.Data.Entity.DbContextTransaction..ctor(EntityConnection connection)
at System.Data.Entity.Database.BeginTransaction()
at Ecms.Utilities.DatabaseVersionHelper.UpdateToVersion(String database, Int32 version)
It seems to occur whenever it creates a new instance of entity like the following code block.
using (var db = new MyEntity())
{
// Do something
}
It was created with "EF Designer from database" option as I add a new "ADO.NET Entity Data Model". I did try to use SQLite but I could never install it and make it work in Visual Studio Community 2015. I also looked at LocalDB but it seems that users have to install something extra along with my application in order to work which is what I'm trying to avoid.
I discovered that the problem arises when users do not have permissions to access AppData (Roaming) folder. I tested on a virtual machine with Windows 7. The app will work if the I have permissions to access AppData (Roaming) folder and vice versa.
However, when tested on a virtual machine with Windows 10, the app works fine regardless of whether I have permissions to access AppData (Roaming) folder or not.
Do note that my application does not make use of AppData (Roaming) folder deliberately. I suspect that however, some of the dependency libraries are using it and so far I could only determine that SQL Server Compact 4.0 is affected.
Also bear in mind that the affected users seem adamant on not changing access permission to the AppData (Roaming) folder.
Interestingly, I also discovered that some applications will not open when AppData (Roaming) folder is restricted such as Notepad++ and Skype.
Does anyone have similar experience? Why is this happening in Windows 7 and not Windows 10? Does AppData (Roaming) folder play a crucial role for many desktop applications to work? Is there a workaround?
Edit: Included the exception and its stack trace
Continue reading...