在解决方案中,我有几个.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