Skip to content

Add partial property support for MA0110 Regex Source Generator#1009

Merged
meziantou merged 3 commits intomainfrom
copilot/update-ma0110-code-fix
Feb 18, 2026
Merged

Add partial property support for MA0110 Regex Source Generator#1009
meziantou merged 3 commits intomainfrom
copilot/update-ma0110-code-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 18, 2026

MA0110 code fix now offers partial properties as an alternative to partial methods when C# 14+ is detected. Both options are presented to the user.

Changes

  • UseRegexSourceGeneratorFixer: Detects C# 14+ via IsCSharp14OrAbove() and registers two code fixes:

    • "Use Regex Source Generator (partial method)" - existing behavior, always available
    • "Use Regex Source Generator (partial property)" - new option, C# 14+ only
  • Property generation: Manually constructs PropertyDeclarationSyntax with proper partial modifier ordering (private static partial). Uses property access (MyRegex) instead of method invocation (MyRegex()).

  • Tests: Added 7 test cases under #if CSHARP14_OR_GREATER covering basic regex creation, options, timeouts, static methods (IsMatch/Replace), and nested types.

Example

Partial method (existing):

partial class Test {
    Regex a = MyRegex();
    
    [GeneratedRegex("pattern")]
    private static partial Regex MyRegex();
}

Partial property (C# 14+):

partial class Test {
    Regex a = MyRegex;
    
    [GeneratedRegex("pattern")]
    private static partial Regex MyRegex { get; }
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1s1vsblobprodcus386.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/Meziantou.Analyzer.slnx --packages /home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true conf�� .CodeFixers/Rules/UseInlineXmlCommentSyntaxWhenPossibleFixer.cs | grep -v '^1$' && echo src/Mezi/usr/lib/systemd/systemd-executor --global sh antou.Analyzer.Cgit (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj --packages /home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true conf�� .CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs | grep -v '^1$' && echo src/Meziantfind --global /opt/pipx_bin/git antou.Analyzer.C/usr/lib/git-core/git (dns block)
  • pdfvsblobprodcus380.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj --packages /home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true conf�� .CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs | grep -v '^1$' && echo src/Meziantfind --global /opt/pipx_bin/git antou.Analyzer.C/usr/lib/git-core/git (dns block)
  • st8vsblobprodcus339.vsblob.vsassets.io
    • Triggering command: /usr/share/dotnet/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/Meziantou.Analyzer.slnx --packages /home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true conf�� .CodeFixers/Rules/UseInlineXmlCommentSyntaxWhenPossibleFixer.cs | grep -v '^1$' && echo src/Mezi/usr/lib/systemd/systemd-executor --global sh antou.Analyzer.Cgit (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/tests/Meziantou.Analyzer.Test/Meziantou.Analyzer.Test.csproj --packages /home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Meziantou.Analyzer/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true conf�� .CodeFixers/Rules/UseIsPatternInsteadOfSequenceEqualFixer.cs | grep -v '^1$' && echo src/Meziantfind --global /opt/pipx_bin/git antou.Analyzer.C/usr/lib/git-core/git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 18, 2026 16:05
Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com>
Copilot AI changed the title [WIP] Update MA0110 code fix to use partial properties Add partial property support for MA0110 Regex Source Generator Feb 18, 2026
Copilot AI requested a review from meziantou February 18, 2026 16:15
@meziantou meziantou marked this pull request as ready for review February 18, 2026 16:43
@meziantou meziantou merged commit 1449ab2 into main Feb 18, 2026
12 checks passed
@meziantou meziantou deleted the copilot/update-ma0110-code-fix branch February 18, 2026 16:43
This was referenced Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants