MA0110 - Use the Regex source generator Use the Regex Source Generator when possible. new Regex("constant pattern"); // report diagnostic // ok [GeneratedRegex("constant pattern")] private static partial Regex MyRegex();