# Solved: C# - Get the line of the error!



## McAvelli (Apr 19, 2008)

Does anyone knows how to get the line on the code where the error occurred.
Thanks for the answer if I get any


----------



## JimmySeal (Sep 25, 2007)

Any Exception object should have a StackTrace property that contains a full stack trace (including line numbers). You could parse that to get just the line number if you want but I don't think there is any way to get just the line number without doing that.


----------



## McAvelli (Apr 19, 2008)

Yes it can be one method. But different errors have different types of interpretation so it's hard to parse those errors with one function to get just the line number.


----------

