我有一个运行在Motorola WT41N0(Windows CE 7)上的.NET CF 3.5应用程序。有时会出现以下异常:
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()
有谁知道可能导致错误的原因。
答案 0 :(得分:0)
当系统内存不足时,似乎会发生此错误。软件中存在内存泄漏,并且由于已经修复,因此异常似乎不再发生。