Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)(\()(?<parameters>[^\)]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))?
|
Description |
Just a simple regExp to parse the stack trace. Developed when using the exception block from MS, coz they only showed the stack all bunched together. Could be used as follows:
[C#]
string regExParams = @"(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)(\()(?<parameters>[^\)]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))?";
Regex re = new System.Text.RegularExpressions.Regex(regExParams,RegexOptions.Compiled);
MatchCollection mtc;
mtc = re.Matches(System.Environment.StackTrace);
foreach(Match mt in mtc)
{
MessageBox.Show(mt.Result("${fullClassName}"));
MessageBox.Show(mt.Result("${methodName}"));
MessageBox.Show(mt.Result("${parameters}"));
MessageBox.Show(mt.Result("${fileName}"));
MessageBox.Show(mt.Result("${lineNumber}"));
}
Seems to work well, but use at your own peril!!
Feel free to use and enhance (there's probably a lot that could be done, like getting parameters individually(?), etc)
|
Matches |
at System.IO.__Error.WinIOError(Int32 errorCode, String str) | at ExceptionManagementQuickStartSampl
|
Non-Matches |
ExceptionManagementQuickStartSamples.Form1.DoLogon(String userName, String password) in c:\program f
|
Author |
Rating:
Mike Stancombe
|
Displaying page
of
pages;
Items to