In the solution I have several .exe
files that sit in the same directory. One of them is a Master Menu, which looks up all the other executables' path (within the same dir) and assigns to buttons in the form. When the button is clicked it's underlying exe is launched via Process.Start()
.
Each exe
is packed in separate installation CAB. After initial install, I run the Master Menu, then pick any of the buttons and underlying app launches successfully. I quit it, then run again the same or any other app but this time it crashes with:
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
is an UserControl which has TextBox.Focus()
in its constructor. I tried to move it out to 'Validated' event handler but the outcome is the same, with one difference that this time it crashes on Form.Load()
when trying to set its own visibility.
The cycle can be repeated after device reset. Most importantly, if I run any of the child executables directly those launch and work fine all the time.
The same code set works fine on WinMo 6.1. I also use OpenNETCF's Application2
class - tried to replace it with standard Application
class with the same result. Tried to set Process.StartInfo.WorkingDirectory
and UseShellExecute
but again no joy. When looking at Process()
object in the "Master Menu" app - it behaves as expected (creates process, returns 'true' on .Start()
etc).
No assemblies are installed to GAC, all files reside in the same dir.
Any clues?
[Edit]
After I get the error and device is left untouched for about 10 minutes it all gets back to start: I can again run sub-app once etc.
Giving that I tried wiping reference to current process from my Master Menu, killing the process, calling GC.Collect()
with no result.
[Edit]
Loader log looks ok up to this point (this is where app starts failing):
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]
After copying System.SR.dll
to app installdir:
Loading module [\windows\en\System.SR.resources.dll]
Attempt to load [\windows\en\System.SR.resources.dll] has failed (err 0x80001001)
Installed System_SR_ENU.CAB
and NETCFv2.wm.armv4i.cab
but now log says that one of the device specific dlls (ITCScan.DLL
) can't be loaded, which I believe to be .NET 3.5 assembly.
As far as I know System.SR
is used only in .NET2, is it not that some other exception is trying to surface and manifests itself like this?