Reputation: 11
I have a basic Compact Framework v3.5 application running on Zebra MC2180 mobile barcode scanners and have a very intermittent issue.
Occasionally (after approx 1 in 20 or so scans), all font styles set on all labels, buttons, etc are lost and revert to the default size 9 font. Any specific "bold" settings or font sizes are lost.
No exceptions are thrown, there is no indication anything has gone wrong except the missing font styles....
If I write a trace on the font style property, when the font info is lost, I get a System.Drawing exception but no further information. It seems to me it is trying to access an unset property? Eg:
System.Diagnostics.Trace.WriteLine(btn_orderChecking.Font.Style);
Produces (very intermittently):
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).
The method producing the error is below. This code snippet takes a barcode and displays product info (pulled from a web service)
case 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;
Upvotes: 1
Views: 361
Reputation: 11
This error does not occur in OS version 82.34.004. You should to update OS to this version. Ondřej
Upvotes: 1