Windows Phone 8应用程序IsolatedStorageException / SecurityExcept

本文关键字:SecurityExcept IsolatedStorageException 应用程序 Phone Windows | 更新日期: 2023-09-27 18:03:06

我有一个Windows Phone 8应用程序,使用Sqlite,它在调试构建中工作良好,但显然不能在发布构建中定位文件。

在发布版本中运行应用程序时,控制台上出现了一长串异常。

下面是一个片段:

An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll
An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll
An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll
An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll
An exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary

…诸如此类。有没有人遇到过这种只在发布版本中出现的异常?调试它的最佳方法是什么?我甚至不确定我的代码的哪一部分是导致这个?

为简洁起见,详细信息如下:

很明显,在其他事情中,我的数据库文件没有被定位。我有一个sqlite数据库文件本地存储在应用程序的目录,当应用程序启动时,它被复制到本地文件夹,并从那里读取和写入。这在所有调试构建中都没有问题,但是现在,我看到"无法打开数据库文件"的日志错误(下面有更多),后面是(迄今为止正确的)数据库文件的路径,并且我的UI元素都没有涉及到对数据库的调用。

我提到了记录消息。显然,我没有在发布版本中使用system . diagnostic . debug获得控制台打印,但我有一个日志系统,它写入一个文件,可以在应用程序中读取。

这似乎工作得很好,我可以在应用程序中阅读它。

此外,我最初有一些错误弹出与SQLite的发布版本,但这些似乎是从使用旧版本的SQLite c#代码,并清除后,我按照以下说明:

您应该在调试器下运行发布版本,并通过更改Visual Studio的Debug>>Exceptions菜单中的设置来找出抛出SecurityException的位置。

这至少可以让你找到这是从哪里来的

Windows Phone 8应用程序IsolatedStorageException / SecurityExcept