CE 6.0 / .NET CF 3.5应用程序遇到一个严重错误(MC3100)应用程序、严重、错误、NET

2023-09-04 01:59:16 作者:来世风华ヽ谁为谁倾绝天下

在退出对摩托罗拉MC3100我的.NET CF 3.5应用程序(CE 6.0版本)我得到错误信息应用程序XXX遇到了严重的错误,需要关闭。然后,我需要预热启动装置的应用程序,以重新工作。

When exiting my .NET CF 3.5 application on the Motorola MC3100 (CE 6.0 version only) I get the error message "Application xxx has encountered a serious error and needs to shut down". I then need to warm boot the device for the application to work again.

这code正常工作,直到应用程序被关闭,如果字体设置在应用程序的控制,只失败。一切都还正常工作的.NET CF 2.0和所有其他Motorola,Intermec的,Psion公司,HHC设备我曾尝试与.NET CF 3.5。

This code works fine until the application is shutdown and it only fails if a font is set on a control in the application. Everything also works fine on .NET CF 2.0 and all of the other Motorola, Intermec, Psion, HHC devices I have tried with .NET CF 3.5.

下面是我目前的测试code:

Here is my current test code:

[MTAThread]
static void Main()
{
  Control oCtrl = new Control();
  oCtrl.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold);

  // Setting the controls font to null works
  // oCtrl.Font = null;  Works

  // Setting the Control to null does not work, still get error
  // oCtrl = null;       Doesn't work

  // Setting a font, not on a control, also works fine.
  // System.Drawing.Font font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold);
}

我已经看到了似乎与几个环节:

I have seen a few links that seem related:

在使用Button2的 在当前退出应用程序崩溃 Problem与CF 3.5和Windows CE 6 Error在接近 Application crashes on exit when using Button2 Problem with CF 3.5 and Windows CE 6 Error on close

但到目前为止,我已经找到了唯一的建议是消除应用程序中的字体。在这种情况下,也只是其中的字体被设置,包括链接组件太多的地方,这将是不可能的。

But so far the only recommendation I have found is to eliminate fonts in the application. In this case there is just too many places where fonts are set, including linked assemblies, that it would be impossible.

有其他人看到这样的事。好像是与控件没有正确处理这些版本的字体。

Has anyone else seen anything like this. It seems like something to do with the controls not properly disposing of the fonts on these versions.

推荐答案

我面临完全一样的问题。 尝试下面的(没有解决的问题):

I faced exactly the same problem. Tried the following (none solved the issue):

删除所有新字体()语句 使用 Form.Close()而不是 Application.Exit() 将整个应用程序到.NET CF 3.5 在尝试删除SQLite的依赖 Remove all the new Font() statements Use Form.Close() instead of Application.Exit() Move the whole application to .NET CF 3.5 Attempt to remove SQLite dependencies

这是最后的工作为我们的情况下,唯一的解决办法,(但是它不是一个pretty的解决方案),已经在 MainForm.Closed()

The only solution that finally worked for our case, (however it is not a "pretty" solution), has been the following command in the MainForm.Closed()

Process.GetCurrentProcess().Kill()