.NET CF Application Process is not terminating. We use AxHost based Windows Media Player Component
Th开发者_开发百科e problems with Windows Media Player on a .NET CF based application are endless. In one of the .NET CF 3.5 applications, we are using ActiveX controls to play videos. The code for the media player ActiveX control is from this MSDN article. It had few memory leak problems, but the bugs are sorted out with the help of this article.
The new problem - when we terminate the application, it closes the user interface but the process is running in the background. This is seen in Task Manager's Processes tab. This hanging process is making the system totally unstable. After playing a video for few yours, the entire system hangs and forces to reboot.
Please help me to understand why the process is hanging in background after closing and what fix in the code terminates the process completely.
First, are you sure you are terminating your app in code (and that this code is executing), or is the user clicking the X on the upper-right (for the touch screen devices). I ask because the X doesn't close an app by default - it only minimizes it (unless you take action to do more yourself, etc.).
Assuming that isn't the problem, it's hard to answer based on this limited info, but my guess would be that there's an ActiveX object that wasn't properly Release'ed. The object in question may be your own app, if you pass a reference to your app to the ActiveX control you are using (and if you don't tell the other control to release you). So I'd suggest going through your code and taking inventory of all COM objects, where they are created, where they are AddRef'ed, etc., and make sure you are Releasing and/or setting them to null (perhaps with additional proper cleanup of the objects themselves, such as first telling them to stop playing anything, etc.).
P.S. Your post was a bit ambiguous as to whether the problem is that the app doesn't exit when it should, or if it is causing the device to hang after intentionally running for a while...
精彩评论