2008-11-04 66 views
2

我們有一個基於導航的WPF應用程序。 直接從Visual Studio運行, ,或者即使我們將文件複製到另一個目錄或另一臺計算機並在其中運行,它也可以正常工作。運行ClickOnce部署的WPF應用程序時的奇怪行爲

我們使用ClickOnce通過互聯網部署應用程序,當時大多數 這不會導致任何問題。

然而,它現在只是完全凍結,你會得到 經典的「應用程序xxxx沒有響應」和一個不響應的用戶界面。

這不會每次都發生,只有在使用部署的版本時纔會發生。 (即使我們在開發機器上測試)。

由於我打字這個消息,我們開始並在quiting部署版本 多次以試圖重現行爲......有時它會連續發生10次,然後它會未來20次罰款。沒有跡象表明可能會造成這種情況。 (只是設法做到這一點)

只是爲了顯示你明白我的意思,這裏是截圖:

alt text http://www.freeimagehosting.net/uploads/1c2c921835.jpg

這件事發生時,雙擊ListBox中的第一項:

LLCOverviewPage llcOverview = new LLCOverviewPage((Controller)this.lstControllers.SelectedItem); 
    this.NavigationService.Navigate(llcOverview); 

應用程序只是永遠保持這種狀態,不會引發異常。

爲LLCOverViewPage的構造是這樣的:

public LLCOverviewPage(Controller CurrentController) 
{ 
    InitializeComponent(); 

    this.currentController = CurrentController.ToLightLinkController(); 
    this.updateControllerInfo();    
} 

的updateControllerInfo()方法顯示頁面, 上的信息,然後調用一個方法,它已經從一個SQL精簡3.5以前加載 更多信息數據庫:

private void updateControllerInfo() 
    { 
     //Update the UI with general properties 
     this.lblDeviceName.Content = this.currentController.ShortName; 
     this.lblEthernetAddress.Content = this.currentController.Eth0.EthernetAddress.ToString(); 
     this.lblTcpPort.Content = this.currentController.Eth0.TcpPort.ToString(); 
     this.lblActuatorThroughputMode.Content = (this.currentController.Dali.ActuatorThroughputMode ? "Enabled" : "Disabled"); 
     this.lblNetmask.Content = (this.currentController.Eth0.Netmask != null ? this.currentController.Eth0.Netmask.ToString() : String.Empty); 
     this.lblDefaultGateway.Content = (this.currentController.Eth0.DefaultGateway != null ? this.currentController.Eth0.DefaultGateway.ToString() : String.Empty);  

     //Update the UI with the ballasts 
     this.updateBallastList(); 
    } 

    private void updateBallastList() 
    { 
     this.lstBallasts.ItemsSource = null; 

     List<BallastListViewItem> listviewItems = new List<BallastListViewItem>(); 
     foreach (DaliBallast ballast in this.currentController.Dali.Ballasts.OrderBy(b => b.ShortAddress)) 
     { 
      listviewItems.Add(new BallastListViewItem(ballast,this.currentController.SerialNumber)); 
     } 

     this.lstBallasts.ItemsSource = listviewItems; 
    } 

就是這樣。頁面構建時沒有其他事情發生。

沒有例外,並且由於應用程序不會崩潰,我幾乎沒有什麼可以繼續尋找問題的。

SQL Compact數據庫存儲在用戶應用程序文件夾 中,所以部署的版本使用與普通版本相同的數據庫, 沒有區別。

所以,只是要明確,這個問題只發生在部署的版本! (測試在Windows XP和Windows Vista兩個不同的機器)

任何想法,什麼可能導致這樣的事情發生, 或者我可能爲了追查下來這個問題試試?

UPDATE

使用一些好的舊調試(寫入日誌信息的文件) 我能夠確定的是我的代碼成功地excecutes和 應用程序只後凍結。

所以,如果你再看看在頁面的構造函數創建:

public LLCOverviewPage(Controller CurrentController) 
    { 
     InitializeComponent(); 

     this.currentController = CurrentController.ToLightLinkController(); 
     this.updateControllerInfo();    
    } 

的this.updateControllerInfo後()是在哪裏申請凍結 不時。這會超出我的代碼嗎?也許是一個WPF錯誤?

更新2 我檢查應用程序事件日誌在Windows中,這是它說:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> 
    <System> 
    <Provider Name="Application Hang" /> 
    <EventID Qualifiers="0">1002</EventID> 
    <Level>2</Level> 
    <Task>101</Task> 
    <Keywords>0x80000000000000</Keywords> 
    <TimeCreated SystemTime="2008-11-04T15:55:55.000Z" /> 
    <EventRecordID>1630</EventRecordID> 
    <Channel>Application</Channel> 
    <Computer>DEVTOP</Computer> 
    <Security /> 
    </System> 
    <EventData> 
    <Data>LLCControl.exe</Data> 
    <Data>1.0.0.0</Data> 
    <Data>2f4</Data> 
    <Data>01c93e95c29f9da5</Data> 
    <Data>20</Data> 
    <Binary>55006E006B006E006F0077006E0000000000</Binary> 
    </EventData> 
</Event> 

二進制文中說:UNKOWN,想我完全pooched ...

更新3 如果我將列表框的事件處理程序代碼更改爲:

LLCOverviewPage llcOverview = new LLCOverviewPage((Controller)this.lstControllers.SelectedItem); 
MessageBox.Show("Navigating Now"); 
this.NavigationService.Navigate(llcOverview) 

它顯示我的應用程序只在導航時凍結!

更新4 我把一些事件處理程序連接到NavigationService。當事件被觸發時,處理程序只需寫入日誌。結果是這樣的:

17時51分35秒瀏覽 17時51分35秒航海下 17時51分35秒LoadCompleted

那麼,爲什麼這是怎麼回事被遺忘?

回答

相關問題