Install any skill in seconds. Free to start, no credit card required.
Get Started Free →When a code-behind transform must locate the class body opening brace (`{`) to inject fields or members, it must use `[^{]*\{` **not** `\s*\{` between the class name and the brace.
77% 100%+23 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 17 of 22 without it.
3 of 3 safety checks passed
Not used yet
When a code-behind transform must locate the class body opening brace ({) to inject fields or members, it must use [^{]*\{ not \s*\{ between the class name and the brace.
Code-behind transforms run in Order sequence. Earlier transforms (e.g., BaseClassStripTransform at Order 200) modify the class declaration before later transforms see it. By Order 220+, a typical Page class looks like:
public partial class ShoppingCart : WebFormsPageBase
{
A regex like partial\s+class\s+\w+\s*\{ fails to match this because : WebFormsPageBase\n is not \s*. The transform silently returns the content unchanged — no injection happens, no error is raised.
// WRONG — fails when base class or interface list is present
private static readonly Regex ClassOpenRegex = new(
@"partial\s+class\s+\w+\s*\{",
RegexOptions.Compiled);
// CORRECT — [^{]* skips base class, interfaces, newlines, anything before {
private static readonly Regex ClassOpenRegex = new(
@"partial\s+class\s+\w+[^{]*\{",
RegexOptions.Compiled);
[^{]* matches : WebFormsPageBase, : Base, IInterface, spaces, newlines — everything up to (but not including) the first {.
Next to this one in the catalogue, plus more from the same author.