我有一个。net CF 3.5应用程序在摩托罗拉WT41N0 (Windows CE 7)上运行,有时它会得到以下异常:
System.ApplicationException: ApplicationException
at System.Threading.EventWaitHandle..ctor(Boolean initialState, EventResetMode mode)
at System.Threading.ManualResetEvent..ctor(Boolean initialState)
异常出现在许多不同的地方。有时它发生在摩托罗拉条码扫描器API (Symbol.Barcode2)中。它也出现在以下代码中:
private void Transmitter_StatusChanged(object sender, TransmitStatusChangedEventArgs e)
{
Invoke(() =>
{
UpdateScanStatus();
});
}
这是UpdateScanStatus方法:
private void UpdateScanStatus()
{
int unsent = THSData.Transmitter.PendingScans;
string unsentText = string.Format("Unsent Scans:{0}", unsent);
if (lblUnsent.Text != unsentText)
lblUnsent.Text = unsentText;
if (HeaderBarWarning != unsent > 0)
{
lblUnsent.Visible = unsent > 0;
UpdateHeaderBar(unsent > 0);
}
}
下面是这个示例的完整堆栈跟踪:
Fatal Error System.ApplicationException: ApplicationException
at System.Threading.EventWaitHandle..ctor(Boolean initialState, EventResetMode mode)
at System.Threading.ManualResetEvent..ctor(Boolean initialState)
at System.Windows.Forms.Control.TASK.get_AsyncWaitHandle()
at System.Windows.Forms.Control.InvokeHelper(Delegate method, Boolean fSynchronous, Object[] rgobjArgs)
at CoreTT.Scanner.THS.UI.Pages.PageLogin.Transmitter_StatusChanged(Object sender, TransmitStatusChangedEventArgs e)
at CoreTT.Scanner.Common.DataAccess.BaseTransmitter.InvokeStatusChange(String oldStatus, String newStatus, Object statusObject)
at CoreTT.Scanner.Common.DataAccess.BaseTransmitter.set_Status(String value)
at CoreTT.Scanner.Common.DataAccess.BaseTransmitter.Transmit()
at CoreTT.Scanner.Common.DataAccess.BaseTransmitter.timer_TimerCallback(Object state)
at System.Threading.Timer.ring()
有谁知道是什么导致了这个错误
这个错误似乎发生在系统内存不足的时候。有一个内存泄漏的软件,因为这已经修复了异常似乎不再发生了。