2013-03-08 81 views
0

我有一个Windows Phone 8应用程序,使用Sqlite,它在调试版本中工作正常,但显然不是在发布版本上查找文件。Windows Phone 8应用程序IsolatedStorageException/SecurityException在发布版本,而不是调试版本

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

这里是一个SNIPPIT:

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 Application

回答

2

你应该在调试器下运行发布版本,并通过更改Visual Studio的“调试>>例外”菜单中的设置来找出SecurityException的位置。

这至少可以让你找到它来自哪里。

+0

感谢您的回复。我有点困惑,我该如何在调试器下运行发布版本?我试图按照[“如何调试发布版本”](http://msdn.microsoft.com/en-us/library/fsk896zz(v = vs.110).aspx)中列出的步骤进行操作,但我是没有看到它在项目属性页面中描述的相同内容。 (我正在使用VS Express 2012 for Windows Phone) – 2013-03-08 16:35:16

+0

只需将VS中的下拉配置组合框从Debug更改为Release,然后按F5。如果你在VS Express中没有看到这个,你需要进入VS选项并打开高级模式或类似的东西。 – 2013-03-08 17:35:55

+0

啊,我不清楚,我很抱歉。是的,我知道如何在发布模式下构建。我认为“调试器”是指用不同的方法来运行发布版本,并提供更多的调试选项(如系统控制台打印)等。 – 2013-03-08 17:53:47

相关问题