Skip to content

MA0109: Skip diagnostic for program entry point Main(string[] args)#1123

Merged
meziantou merged 2 commits into
mainfrom
copilot/fix-ma0109-trigger
May 5, 2026
Merged

MA0109: Skip diagnostic for program entry point Main(string[] args)#1123
meziantou merged 2 commits into
mainfrom
copilot/fix-ma0109-trigger

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

MA0109 was incorrectly flagging Main(string[] args) as needing a Span<T>/Memory<T> overload, despite the entry point signature being fixed by the runtime — there's no valid overload to add.

Changes

  • Analyzer (AddOverloadWithSpanOrMemoryAnalyzer): Skip analysis when the method is the compilation's entry point via Compilation.GetEntryPoint(...).
  • Tests: Added EntryPoint_Main_ShouldNotTrigger (no diagnostic on Main) and EntryPoint_NonMainMethod_ShouldTrigger (other string[] methods in a console app still report).
  • Docs: Updated MA0109.md to document the entry point exception.
// Before: triggered MA0109
public static void Main(string[] args) { }

// After: no diagnostic — entry point signature is runtime-mandated
public static void Main(string[] args) { }

Copilot AI linked an issue May 5, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix MA0109 triggering on Main method MA0109: Skip diagnostic for program entry point Main(string[] args) May 5, 2026
Copilot AI requested a review from meziantou May 5, 2026 15:46
@meziantou meziantou marked this pull request as ready for review May 5, 2026 15:52
@meziantou meziantou merged commit d3d88bc into main May 5, 2026
13 checks passed
@meziantou meziantou deleted the copilot/fix-ma0109-trigger branch May 5, 2026 16:03
This was referenced May 5, 2026
This was referenced May 12, 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.

MA0109 shouldn't trigger on Main(string[] args)

2 participants