我在Zebra MC2180移动条形码扫描仪上运行了一个基本的Compact Framework v3.5应用程序,并且有一个非常间歇性的问题。
偶尔(大约在20次左右的扫描中),所有标签,按钮等上设置的所有字体样式都会丢失并恢复为默认的9号字体。任何特定的“粗体”设置或字体大小都会丢失。
没有抛出任何异常,除了丢失的字体样式之外没有任何迹象表明出现了错误....
如果我在字体样式属性上写了一个跟踪,当字体信息丢失时,我得到一个System.Drawing异常但没有进一步的信息。在我看来它试图访问一个未设置的属性?例如:
System.Diagnostics.Trace.WriteLine(btn_orderChecking.Font.Style);
产生(非常间歇):
A first chance exception of type 'System.Exception' occurred in System.Drawing.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type 'System.Exception' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Symbol.Barcode2.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
The program '[0x2C50F9A] MC2180.exe: Managed' has exited with code 0 (0x0).
产生错误的方法如下。此代码段采用条形码并显示产品信息(从Web服务中提取)
案例PANEL_PLU:
clearPLUpanel();
pluDataPartno.Text = "LOADING"; // This never gets seen - panel doesn't get repainted
lblScanBarcode.Hide();
panelError.Hide();
payload = new Dictionary<String, String>();
payload.Add("barcode", scanData.Text);
request = new dataRequest("plu",payload);
res = dataTransfer.sendRequest(request);
if (res.result == "ok")
{
// We're good, populate and show fields
playHappyBeep();
pluItem_Id = res.item_id;
pluDataPartno.Text = res.item_partno;
pluDataName.Text = res.item_name;
pluDataFreeStock.Text = res.item_freeStock.ToString();
pluDatalAllocated.Text = res.allocated_stock.ToString();
pluDataLoc.Text = res.loc_name;
pluDataShelfStock.Text = res.item_shelfStock.ToString();
pluLabelAllocated.Show();
pluLabelFreeStock.Show();
pluLabelLoc.Show();
pluLabelShelfStock.Show();
pluImage.Show();
plu_btnChangeLoc.Show();
plu_btnAutoLocate.Show();
if (res.image_url.StartsWith("http")) {
pluImage.Url = new System.Uri(res.image_url);
}
if (res.item_freeStock > 0)
{
pluDataFreeStock.ForeColor = Color.Green;
}
else
{
pluDataFreeStock.ForeColor = Color.Red;
}
}
else
{
playErrorBeep();
clearPLUpanel();
lblErrorHeadline.Text = res.error_info;
panelError.Show();
}
System.Diagnostics.Trace.WriteLine(btn_orderChecking.Font.Style); // This is the line that occasionally throws the exception
break;
答案 0 :(得分:1)
在OS版本82.34.004中不会发生此错误。您应该将操作系统更新到此版本。 昂德里奇