在解決方案中,我有幾個.exe
文件位於同一個目錄中。其中一個是Master Menu,它查找所有其他可執行文件的路徑(在同一個目錄中)並將其分配給表單中的按鈕。當按鈕被點擊時,它的底層exe通過Process.Start()
啓動。Windows Mobile 6.5 - Process.Start上的TypeLoadException()
每個exe
包裝在獨立安裝的CAB中。初次安裝後,我運行主菜單,然後選擇任何按鈕和底層應用程序啓動成功。我退出它,然後再次運行相同或任何其他應用程序,但這次它與崩潰:
TypeLoadException
at System.Windows.Forms.Control.OnGotFocus(EventArgs e)
at System.Windows.Forms.Control.WnProc(WM wm, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
at Microsoft.AGL.Forms.WL.SetFocus(IntPtr hwnFocus)
at System.Windows.Forms.Control.Focus()
at myApp.Login..ctor()
at myApp.Form_UnderApp1.InitializeComponent()
at myApp.Form_UnderApp1..ctor()
at myApp.Program.Main()
myApp.Login
是在其構造TextBox.Focus()
的用戶控件。我嘗試將其移出到「已驗證」事件處理程序,但結果相同,但有一點不同,這次它在嘗試設置其自己的可見性時在Form.Load()
上崩潰。
設備復位後可以重複該循環。最重要的是,如果我直接運行任何子可執行文件,那麼啓動並始終正常工作。
相同的代碼集在WinMo 6.1上運行良好。我也使用OpenNETCF的Application2
類 - 試圖用標準Application
類替換它,結果相同。試圖設置Process.StartInfo.WorkingDirectory
和UseShellExecute
,但再次沒有喜悅。當在「主菜單」應用程序中查看Process()
對象時,它的行爲與預期相同(創建進程,在.Start()
等中返回「true」)。
沒有程序集安裝到GAC,所有文件駐留在相同的目錄中。
任何線索?
[編輯]
後,我得到的錯誤和設備被原封不動約10分鐘,這一切得到回至開始:我可以再次跑分應用程序,一旦等 給予我試着擦參考當前進程從我的主菜單,殺死進程,調用GC.Collect()
沒有結果。
[編輯]
裝載機日誌看起來確定到這一點(這是在應用程序啓動失敗):
Redirecting [Microsoft.WindowsCE.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC] to [Microsoft.WindowsCE.Forms, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC]
Loading module [\windows\GAC_Microsoft.WindowsCE.Forms_v3_5_0_0_cneutral_1.dll]
Loaded [Microsoft.WindowsCE.Forms, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC] from [\windows\GAC_Microsoft.WindowsCE.Forms_v3_5_0_0_cneutral_1.dll]
Loading module [\Program Files\MyApp\System.SR.dll]
Attempt to load [\Program Files\MyApp\System.SR.dll] has failed (err 0x80001000).
Loading module [\Program Files\MyApp\System.SR.exe]
Attempt to load [\Program Files\MyApp\System.SR.exe] has failed (err 0x80001000).
Loading module [\windows\System.SR.dll]
Attempt to load [\windows\System.SR.dll] has failed (err 0x80001000).
Loading module [\windows\System.SR.exe]
Attempt to load [\windows\System.SR.exe] has failed (err 0x80001000).
Failed to load [System.SR, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC]
複製System.SR.dll
到App安裝目錄後:
Loading module [\windows\en\System.SR.resources.dll]
Attempt to load [\windows\en\System.SR.resources.dll] has failed (err 0x80001001)
安裝System_SR_ENU.CAB
和NETCFv2.wm.armv4i.cab
但現在日誌說明一個設備特定dll(ITCScan.DLL
)不能是l oaded,我相信這是.NET 3.5組裝。 據我所知System.SR
僅在.NET2中使用,是不是某些其他異常試圖表現出來並像這樣表現出來?
您是否試過打開日誌記錄並查看加載器日誌以查看可能發生的事情? (http://msdn.microsoft.com/en-us/library/ms229650%28v=VS.90%29.aspx) – ctacke
@ctacke裝載機日誌留給我更糊塗了(更新後),我會繼續尋找 – StaWho
僅供參考:ITCScan不是.NET 3.5程序集。這是來自Intermec的本地圖書館。 – pdriegen