在解决方案中,我有几个.exe
文件位于同一目录中。其中之一是主菜单,它查找所有其他可执行文件的路径(在同一目录中)并分配给表单中的按钮。单击按钮时,它的底层 exe 将通过Process.Start()
.
每个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()
是一个在其构造函数中的 UserControl 。我试图将其移至“已验证”事件处理程序,但结果是相同的,不同之处在于这次它在Form.Load()
尝试设置自己的可见性时崩溃。
设备复位后可以重复该循环。最重要的是,如果我直接运行任何子可执行文件,它们就会一直启动并正常工作。
相同的代码集在 WinMo 6.1 上运行良好。我还使用 OpenNETCF 的Application2
类 - 尝试用标准Application
类替换它,结果相同。试图设置Process.StartInfo.WorkingDirectory
,UseShellExecute
但又没有快乐。在“主菜单”应用程序中查看Process()
对象时 - 它的行为符合预期(创建进程,返回“真”.Start()
等)。
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
到应用安装目录后:
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
但现在日志显示ITCScan.DLL
无法加载设备特定的 dll ( ) 之一,我认为这是 .NET 3.5 程序集。据我所知System.SR
,仅在 .NET2 中使用,难道不是其他一些异常正试图浮出水面并像这样表现出来吗?