Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ partial class StackTraceParser
const string Space = @"[\x20\t]";
const string NotSpace = @"[^\x20\t]";

static readonly Regex Regex = new Regex(@"
[GeneratedRegex(@"
^
" + Space + @"*
\w+ " + Space + @"+
Expand Down Expand Up @@ -71,7 +71,10 @@ partial class StackTraceParser
// fall into the "catastrophic backtracking" trap due to over
// generalization.
// https://github.com/atifaziz/StackTraceParser/issues/4
TimeSpan.FromSeconds(5));
5000)]
private static partial Regex StackTraceRegex();

static readonly Regex StackTraceRegexInstance = StackTraceRegex();

public static IEnumerable<T> Parse<T>(
string text,
Expand Down Expand Up @@ -104,7 +107,7 @@ public static IEnumerable<TFrame> Parse<TToken, TMethod, TParameters, TParameter
if (sourceLocationSelector == null) throw new ArgumentNullException("sourceLocationSelector");
if (selector == null) throw new ArgumentNullException("selector");

return from Match m in Regex.Matches(text)
return from Match m in StackTraceRegexInstance.Matches(text)
select m.Groups into groups
let pt = groups["pt"].Captures
let pn = groups["pn"].Captures
Expand Down