Skip to content

Commit

Permalink
Suppressing RequiresDynamicCodeAttribute for Compiled Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshanF committed Mar 29, 2022
1 parent aded314 commit a26195e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace System.Text.RegularExpressions
/// <summary>
/// RegexCompiler translates a block of RegexCode to MSIL, and creates a subclass of the RegexRunner type.
/// </summary>
[UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode",
Justification = "Native AOT does not use compiled Regex")]
internal abstract class RegexCompiler
{
private static readonly FieldInfo s_runtextstartField = RegexRunnerField("runtextstart");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;
using System.Diagnostics.CodeAnalysis;

namespace System.Text.RegularExpressions
{
Expand Down Expand Up @@ -65,6 +66,8 @@ internal sealed class RegexLWCGCompiler : RegexCompiler
}

/// <summary>Begins the definition of a new method (no args) with a specified return value.</summary>
[UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode",
Justification = "Native AOT does not use compiled Regex")]
private DynamicMethod DefineDynamicMethod(string methname, Type? returntype, Type hostType, Type[] paramTypes)
{
// We're claiming that these are static methods, but really they are instance methods.
Expand Down

0 comments on commit a26195e

Please sign in to comment.