microsoft / microsoft/vs-threading
Avoid reporting VSTHRD200 violation for async Main method when using System.CommandLine.DragonFruit
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1k
- Forks
- 160
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 28
Description
Is your feature request related to a problem? Please describe.
When using System.CommandLine.DragonFruit, a violation of VSTHRD200 is currently reported for an async Task Main(...) method with named arguments. This appears to be due to the fact that this form of Main method is not identified as the entry point in the semantic model compilation, but instead is identified via System.CommandLine.DragonFruit.EntryPointDiscoverer.
Describe the solution you'd like
It would be convenient if a DragonFruit-style async Main method did not trigger VSTHRD200. This could be accomplished by using the EntryPointDiscoverer to try to identify the entry point if one is not found using the semantic model and System.CommandLine is referenced.
Describe alternatives you've considered
It's obviously feasible to suppress a violation of the rule as a false positive. However, this is equally true for a "standard" async Main method, and addressing that one (#187) appears to have been deemed worthwhile.
Additional context
n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing System.CommandLine.DragonFruit.EntryPointDiscoverer.cs and the analyzer's semantic-model entry-point lookup. Done means a DragonFruit-style async Task Main method with named arguments no longer reports VSTHRD200 when System.CommandLine is referenced, while standard entry-point behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100