M
Martin Christiansen
Hi all.
I have a strange problem:
Hardware:
Psion industry-PDA running Windows Mobile 6 + .NET Compact Framework (2.0 I
think).
Problem:
On that unit I run a small shell program named AppLauncher (home made,
..net), that I can use to start other programs.
Now I choose to let this shell program start another .NET program called
'RDC':
RDC.EXE is located in its own folder. RDC.EXE starts and runs as planned,
and RDC makes use of a few other DLL's. Among these DLLs is PtxSdkCommon.dll
which is a DLL interfacing to the handheld's hardware. PtxSdkCommon.dll may
be a 'normal' (unmanaged) dll.
After having finished working with the RDC program I close it, and I find
myself back in the shell program. Everything looks fine, except for the
fact, that the PtxSdkCommon.dll is still reported to be in use - thus it
cannot be deleted from the file system!
This is very strange, because when I check the list of running programs, the
RDC program is not (and should not be) present in the list - only the shell
program is listed.
Despite that the shell program has absolutely no knowledge of the
PtxSdkCommon.dll, that DLL reamains locked until I kill the shell program.
Only then the PtxSdkCommon.dll can be deleted. It is only that particular
DLL, that is locked - all other DLLs that the RDC program uses can be
deleted without any problems.
What is happening here???
It should be mentioned, that if I just start the shell program *without*
letting it start the RDC program, then there is no problem in deleting the
PtxSdkCommon.dll.
Technical background information:
The shell program starts the RDC program this way:
1) The shell program creates a new AppDomain for the RDC program to run in:
executingDomain = AppDomain.CreateDomain(...);
2) The shell program starts a new thread that in turn starts the RDC program
this way:
executingDomain.ExecuteAssembly( <path to RDC.EXE> )
This call does not return until RDC.EXE is closed by the user.
3) When RDC.EXE is closed the call above returns, and the thread tears down
the AppDomain:
AppDomain.Unload( executingDomain )
It's being checked that AppDomain.Unload(...) does not cause any exceptions,
so the unload of the AppDomain is assumed to have completed successfully. It
should be said, though, that it's not the same thread that takes care of
both creation and unloading the AppDomain. Does that matter?
According to the documentation a succesfull unload should guarantee that all
threads have been killed and all assemblies freed, right? How can the
PtxSdkCommon.dll then remain locked??? How can I overcome the problem? (I
need to be able to upgrade/replace all the files in the RDC folder,
including the PtxSdkCommon.dll, without closing down the shell program or
rebooting the device).
Hope that someone can explain.
-Martin.
I have a strange problem:
Hardware:
Psion industry-PDA running Windows Mobile 6 + .NET Compact Framework (2.0 I
think).
Problem:
On that unit I run a small shell program named AppLauncher (home made,
..net), that I can use to start other programs.
Now I choose to let this shell program start another .NET program called
'RDC':
RDC.EXE is located in its own folder. RDC.EXE starts and runs as planned,
and RDC makes use of a few other DLL's. Among these DLLs is PtxSdkCommon.dll
which is a DLL interfacing to the handheld's hardware. PtxSdkCommon.dll may
be a 'normal' (unmanaged) dll.
After having finished working with the RDC program I close it, and I find
myself back in the shell program. Everything looks fine, except for the
fact, that the PtxSdkCommon.dll is still reported to be in use - thus it
cannot be deleted from the file system!
This is very strange, because when I check the list of running programs, the
RDC program is not (and should not be) present in the list - only the shell
program is listed.
Despite that the shell program has absolutely no knowledge of the
PtxSdkCommon.dll, that DLL reamains locked until I kill the shell program.
Only then the PtxSdkCommon.dll can be deleted. It is only that particular
DLL, that is locked - all other DLLs that the RDC program uses can be
deleted without any problems.
What is happening here???
It should be mentioned, that if I just start the shell program *without*
letting it start the RDC program, then there is no problem in deleting the
PtxSdkCommon.dll.
Technical background information:
The shell program starts the RDC program this way:
1) The shell program creates a new AppDomain for the RDC program to run in:
executingDomain = AppDomain.CreateDomain(...);
2) The shell program starts a new thread that in turn starts the RDC program
this way:
executingDomain.ExecuteAssembly( <path to RDC.EXE> )
This call does not return until RDC.EXE is closed by the user.
3) When RDC.EXE is closed the call above returns, and the thread tears down
the AppDomain:
AppDomain.Unload( executingDomain )
It's being checked that AppDomain.Unload(...) does not cause any exceptions,
so the unload of the AppDomain is assumed to have completed successfully. It
should be said, though, that it's not the same thread that takes care of
both creation and unloading the AppDomain. Does that matter?
According to the documentation a succesfull unload should guarantee that all
threads have been killed and all assemblies freed, right? How can the
PtxSdkCommon.dll then remain locked??? How can I overcome the problem? (I
need to be able to upgrade/replace all the files in the RDC folder,
including the PtxSdkCommon.dll, without closing down the shell program or
rebooting the device).
Hope that someone can explain.
-Martin.