Mohith

Mohith

  • NA
  • 2
  • 0

Exception - Stack Trace

Aug 9 2006 12:08 AM
Hi All, I am using .net 2005 edition. Herez my code snippet: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnAdd_Click(object sender, EventArgs e) { try { FillText(); } catch (System.Exception exx) { MessageBox.Show(exx.StackTrace, "Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop); } } private void FillText() { try { txtName.Text = "ABC"; string a = null; string b = a.ToString(); } catch (System.Exception ex) { throw; //throw ex; //throw new System.Exception(); } } } ----- when the excp.StackTrace gets printed, the line number of the exception is pointed to the "throw" statement in the catch block of FillText() method. Whereas it should be pointing to the "string b = a.ToString();" statement in the try block of the same method. Isnt it incorrect?