Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows Phone 8应用程序在生成版本时隔离存储异常/安全异常,而不是调试生成_C#_Sqlite_Visual Studio 2012_Windows Phone 8 - Fatal编程技术网

C# Windows Phone 8应用程序在生成版本时隔离存储异常/安全异常,而不是调试生成

C# Windows Phone 8应用程序在生成版本时隔离存储异常/安全异常,而不是调试生成,c#,sqlite,visual-studio-2012,windows-phone-8,C#,Sqlite,Visual Studio 2012,Windows Phone 8,我有一个WindowsPhone8应用程序,使用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 typ

我有一个WindowsPhone8应用程序,使用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的“调试>>异常”菜单中的设置,找出引发
安全异常的位置


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

感谢您的回复。我有点困惑,如何在调试器下运行发布版本?我正在尝试按照中概述的步骤进行操作,但我没有看到它在项目属性页中描述的内容。(顺便说一下,我正在使用VS Express 2012 for Windows Phone)只需将VS中的下拉配置组合框从调试更改为发布,然后点击F5。如果你在VS Express中看不到这一点,你需要进入VS选项并打开高级模式或类似的东西。啊,我不清楚,我道歉。是的,我知道如何在发布模式下构建。我认为“debugger”指的是运行发布版本的另一种方法,它有更多的调试选项(如系统控制台打印)或其他可用的东西。