I am working with compact framework on C# and I get a runtime exception of 'Exception was unhandled'. It does not happen always but in most cases. Following are the details of this exception.
System.Exception was unhandled
Message="Exception"
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Drawing.Bitmap._InitFromMemoryStream()
at System.Drawing.Bitmap..ctor()
at localize.Form1.displaymap()
at localize.Form1.computeposition()
at localize.Form1.proceed_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at localize.Program.Main()
------------------------------
I have the debugging option of just my code already enabled. Is there anything you can suggest me
Many Thanks!!!
Arpit.

Exception was unhandled
mkamioner
The real code is very big, but I can put a part of it. The line at which the exception occurs is underlined.
private void displaymap(){
if (bmp_map != null){
picturebox_map.Image =
null;bmp_map.Dispose();
}
if (bmp_map_zoom != null){
picturebox_map.Image =
null;bmp_map_zoom.Dispose();
}
if (g != null){
g.Dispose();
}
bmp_map =
new Bitmap(@"\Localize\Images\" + currentfloor.TrimStart('f', 'l', 'o', 'r', '-') + ".jpg"); <<<<<<<<<<<<<<<< this is where exception occurs.bmp_map_zoom =
new Bitmap((int)(Math.Round((double)(bmp_map.Width * 0.25 * zoom_index), 0)), (int)(Math.Round((double)(bmp_map.Height * 0.25 * zoom_index), 0)));g =
Graphics.FromImage(bmp_map_zoom);g.DrawImage(bmp_map,
new Rectangle(0, 0, bmp_map_zoom.Width, bmp_map_zoom.Height), new Rectangle(0, 0, bmp_map.Width, bmp_map.Height), GraphicsUnit.Pixel);picturebox_map.Width = bmp_map_zoom.Width;
picturebox_map.Height = bmp_map_zoom.Height;
picturebox_map.Image = bmp_map_zoom;
picturebox_map.Visible =
true; int ax = (int)(Math.Round((double)(Int32.Parse(tnx[0].ToString()) * 0.25 * zoom_index), 0)); int ay = (int)(Math.Round((double)(Int32.Parse(tny[0].ToString()) * 0.25 * zoom_index), 0)); int bx = (int)(Math.Round((double)(Int32.Parse(tnx[1].ToString()) * 0.25 * zoom_index), 0)); int by = (int)(Math.Round((double)(Int32.Parse(tny[1].ToString()) * 0.25 * zoom_index), 0)); int cx = (int)(Math.Round((double)(Int32.Parse(tnx[2].ToString()) * 0.25 * zoom_index), 0)); int cy = (int)(Math.Round((double)(Int32.Parse(tny[2].ToString()) * 0.25 * zoom_index), 0));x_topnode = ax;
y_topnode = ay;
x_topnode_centre = -x_topnode + 120;
y_topnode_centre = -y_topnode + 146;
picturebox_map.Location =
new Point(x_topnode_centre, y_topnode_centre);picturebox_map.Refresh();
Point previous_one = new Point(ax, ay); Point previous_two = new Point(bx, by); Point previous_three = new Point(cx, cy); Point[] localization_triangle = { previous_one, previous_two, previous_three };g.DrawPolygon(
new Pen(Color.OrangeRed), localization_triangle);g.FillEllipse(
new SolidBrush(Color.Red), ax - zoom_index, ay - zoom_index, zoom_index * 2, zoom_index * 2);g.FillEllipse(
new SolidBrush(Color.Orange), bx - zoom_index, by - zoom_index, zoom_index * 2, zoom_index * 2);g.FillEllipse(
new SolidBrush(Color.Yellow), cx - zoom_index, cy - zoom_index, zoom_index * 2, zoom_index * 2);picturebox_map.Refresh();
progressBar1.Value = 0;
progressBar2.Value = 0;
progressBar3.Value = 0;
zoomin.Enabled =
true;zoomout.Enabled =
true;}
I wonder if its going to be of any use to assist me. I'll wait for any suggestions.
Thanks!!!
Divermarv
-Noah Falk
.Net Compact Framework
Pinnaka Syam Babu
Moved to .NET CF Forum.
Where is the exception being thrown from can you show us the code where the exception is being thrown from