我有一个使用 Sqlite 的 Windows Phone 8 应用程序,它在调试版本中运行良好,但显然没有在发布版本中定位文件。
在发布版本中运行应用程序时,控制台上会显示一长串异常。
这是一个片段:
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# 代码,并在我按照以下说明进行操作后清除:A Workaround To Use SQLite In A Windows Phone 8应用