Field not found exception with compiled dll regula

2019-05-28 18:30发布

I'm having trouble with this error and been searched for a solution on google but there aren't any.

Exception: Field not found: 'System.Text.RegularExpressions.Regex.internalMatchTimeout'.

My regular expression is :

TheExpressions.Add("ExtractURL", @"\b(?:(?:https?|ftp|file)://|www\.|ftp\.)
  (?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#/%=~_|$?!:,.])*
  (?:\([-A-Z0-9+&@#/%=~_|$?!:,.]*\)|[A-Z0-9+&@#/%=~_|$])");

Code to compile with options:

CI[Cnt++] = new RegexCompilationInfo((string)de.Value,        // the reg. ex pattern
                                                 RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled,   // Options to specify
                                                 (string)de.Key,          // name of the pattern
                                                 "TheRegularExpressions", // name space name
                                                 true);                  // Public?

Thanks.

1条回答
姐就是有狂的资本
2楼-- · 2019-05-28 19:03

It seems that the internalMatchTimeout field is new in .NET 4.5. Check to make sure that you aren't somehow mixing .NET library versions.

查看更多
登录 后发表回答