Last active
January 28, 2024 01:38
-
-
Save michaelviveiros/7e47ea66b6f33a2588e594aea036ba92 to your computer and use it in GitHub Desktop.
GetLineNumberDuringErrorException
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
//Your Code | |
} | |
catch (Exception ex) | |
{ | |
// Get stack trace for the exception with source file information | |
var st = new StackTrace(ex, true); | |
// Get the top stack frame | |
var frame = st.GetFrame(0); | |
// Get the line number from the stack frame | |
var line = frame.GetFileLineNumber(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment