2013-03-08 31 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

相關問題