Hi,
We have recently come across an issue in the Desktop edition. Its an odd one as it was reletively stable up to recently and now has a failure rate of 1 in 5 approx
Its version 1.9.9.0 and we do not really have the option to upgrade the version due to a requirement to have a single code base for your control and a similiar mapping control from another company.
Ther error is as follows
[code]
System.NullReferenceException: Object reference not set to an instance of an object.
at MapSuite.PointSymbol.<wbr></wbr>x5742df8843531008(Graphics x26463655896fd90a, PointF x16e7d05e95ffc559, Int32 xecf3f89d109103f0)
at MapSuite.x89b9a80ac14aac3c.<wbr></wbr>x84f206812527b179(PointShape x4c00bddb787f5373, PointSymbol xf68823e5843c57b5, Graphics x4b101060f4767186)
at MapSuite.x89b9a80ac14aac3c.<wbr></wbr>xbb3ab26224254e16(<wbr></wbr>BasePointShape x174ea74f76141149, PointSymbol xf68823e5843c57b5, Graphics x4b101060f4767186)
at MapSuite.x89b9a80ac14aac3c.<wbr></wbr>xf589b8729f3cc594(BaseShape x03c38152d982a760, SymbolCollection x47bc1251e023ae7a, Graphics x4b101060f4767186)
at MapSuite.x89b9a80ac14aac3c.<wbr></wbr>x856e9cb91b29b102(Graphics x4b101060f4767186, RectangleR x11b26402f0e77f36, Int32 x16b4694008f8d95e, Int32 x54b8cb6e1038ec5c, MapLengthUnits x5fee638c5fc2da6e, BaseMapShapeCollection xb0d6ab561df514a8, Single x9a041a6675113840)
at MapSuite.x89b9a80ac14aac3c.<wbr></wbr>GetMapShapes(Graphics g, RectangleR Extent, Int32 CanvasWidth, Int32 CanvasHeight, MapLengthUnits MapUnit, Single MapRotation)
at MapSuite.Winforms.Map.<wbr></wbr>x289dcc1ddd0e8e22(Graphics x4b101060f4767186)
at MapSuite.Winforms.Map.<wbr></wbr>x3cd52c1053cb13d7(Object xe0292b9ed559da7d, PaintEventArgs xfbf34718e704c6bc)
at System.Windows.Forms.Control.<wbr></wbr>OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.<wbr></wbr>PaintWithErrorHandling(<wbr></wbr>PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.<wbr></wbr>WmPaint(Message& m)
at System.Windows.Forms.Control.<wbr></wbr>WndProc(Message& m)
at System.Windows.Forms.Control.<wbr></wbr>ControlNativeWindow.OnMessage(<wbr></wbr>Message& m)
at System.Windows.Forms.Control.<wbr></wbr>ControlNativeWindow.WndProc(<wbr></wbr>Message& m)
at System.Windows.Forms.<wbr></wbr>NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
.
---------------------------------------------------------------------------------------------------------
DrawTruck(m_Metrics.Table.Rows<i>);</i>
map1.RefreshDynamic
----------------------------------
DrawTruck(m_Metrics.Table.Rows<i>);</i>
map1.RefreshDynamic(); // error happens here or shortky aftermic(); // error happens here or shortky after
private void DrawTruck(DataRow p_row)
{
try
{
string l_shapeName = "";
if (p_row == null)
return;
string l_truck = p_row["VehicleId"].ToString();
DataTable l_truckTable = p_row.Table.Clone();
l_truckTable.Rows.Add(p_row.ItemArray);
p_row = l_truckTable.Rows[0];
if ((p_row["Latitude"].ToString() == "") ||
(p_row["Longitude"].ToString() == "") ||
(p_row["Latitude"].ToString() == "0") ||
(p_row["Longitude"].ToString() == "0"))
{
// log error
return;
}
PointSymbol TruckPointSymbol = new PointSymbol(PointStyleEnum.BitMap);
PointShape TruckPointShape = new PointShape();
LocationXY l_locXY = new LocationXY(0, 0);
l_locXY = m_coordConvert.FromLatLong(l_locXY);
MapSuite.Geometry.PointR l_loc = new PointR(l_locXY.X, l_locXY.Y);
l_shapeName = p_row["VehicleId"].ToString() + "Icon";
if (myForm.map1.MapShapes[l_shapeName] == null)
{
PointMapShape TruckMapShape = new PointMapShape();
TruckMapShape.BaseShape = TruckPointShape;
TruckMapShape.ThresholdUnit = ThresholdUnits.kilometres;
Threshold TruckThreshold = new Threshold(100000, 0);
//Build up the Text Symbol for the Truck Label
TextSymbol TruckLabelTextSymbol = new TextSymbol(new Font("Arial", 8, FontStyle.Bold), new SolidBrush(Color.Black));
TruckLabelTextSymbol.HasMask = true;
TruckLabelTextSymbol.Mask.Pen = new Pen(Color.Black, 2);
TruckLabelTextSymbol.XOffset = -10;
TruckLabelTextSymbol.YOffset = -20;
//Create a Label Renderer that will Label the Truck based upon the Name and Speed columns in the Datatable
LabelRenderer TruckLabelRenderer = new LabelRenderer();
TruckLabelRenderer.TextFieldName = "[VehicleId]";
TruckLabelRenderer.Symbols.Add(TruckLabelTextSymbol);
TruckThreshold.LabelRenderers.Add(TruckLabelRenderer);
TruckThreshold.SymbolRenderers.Add(new SymbolRenderer(TruckPointSymbol));
TruckMapShape.Thresholds.Add(TruckThreshold);
myForm.map1.MapShapes.Add(l_shapeName, TruckMapShape);
}
else
{
SymbolRenderer MySymbolRenderer = (SymbolRenderer)myForm.map1.MapShapes[l_shapeName].Thresholds[0].SymbolRenderers[0];
TruckPointSymbol = (PointSymbol)MySymbolRenderer.Symbols[0];
TruckPointShape = (PointShape)myForm.map1.MapShapes[l_shapeName].BaseShape;
}
myForm.map1.MapShapes[l_shapeName].DataTable = l_truckTable;
TruckPointSymbol.BitMap = (new Bitmap(@".\Truck1.gif"));
if (Convert.ToDouble(p_row["Latitude"].ToString()) != 0 & Convert.ToDouble(p_row["Longitude"].ToString()) != 0)
{
l_locXY = new LocationXY(double.Parse(p_row["Latitude"].ToString()) + myForm.config.Main[0].LatitudeComp, double.Parse(p_row["Longitude"].ToString()) + myForm.config.Main[0].LongitudeComp);
l_locXY = m_coordConvert.FromLatLong(l_locXY);
l_loc = new PointR(l_locXY.X, l_locXY.Y);
TruckPointShape.X = l_loc.X; // Set X value of truck
TruckPointShape.Y = l_loc.Y; // Set Y value of truck
}
}
catch (Exception Ow)
{
// log error }
}
Any ideas or any advise on debugging this further. I have a suspicion that it could be due to a lock on the gif but am not sure.
Thanks in advance,
Liam