Conversation
…tedRegex Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com> Agent-Logs-Url: https://github.com/meziantou/Meziantou.Analyzer/sessions/8432e8d8-b60b-46bc-ad54-cd77c4e31ec4
|
@copilot CI errors because the methods are not in #if CSHARP12_OR_GREATER |
| return; | ||
|
|
||
| // Must return Regex | ||
| var regexSymbol = context.Compilation.GetBestTypeByMetadataName("System.Text.RegularExpressions.Regex"); |
There was a problem hiding this comment.
@copilot Get the symbol in RegisterCompilationStartAction instead of using this method in each method.
There was a problem hiding this comment.
Done in d7068a8. regexSymbol is now looked up once in RegisterCompilationStartAction and passed into AnalyzeMethod alongside generatedRegexAttributeSymbol.
| return; | ||
|
|
||
| // Must have GeneratedRegex attribute | ||
| foreach (var attribute in method.GetAttributes()) |
…P12_OR_GREATER Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com> Agent-Logs-Url: https://github.com/meziantou/Meziantou.Analyzer/sessions/548affa9-c004-4554-83b6-a1f6719edf3e
Fixed in 0a24c09. The |
…asAttribute helper Co-authored-by: meziantou <509220+meziantou@users.noreply.github.com> Agent-Logs-Url: https://github.com/meziantou/Meziantou.Analyzer/sessions/4f6b3d0a-6e6f-4d89-a9fa-153a0f3c71aa
MA0190constant toRuleIdentifiers.csUsePartialPropertyInsteadOfPartialMethodForGeneratedRegexAnalyzer.csUsePartialPropertyInsteadOfPartialMethodForGeneratedRegexFixer.csUsePartialPropertyInsteadOfPartialMethodForGeneratedRegexAnalyzerTests.csdocs/Rules/MA0190.mdCSharp12_NoDiagnostictest wrapped in#if CSHARP12_OR_GREATER;NoGeneratedRegexAttribute_NoDiagnostickept outside#ifto ensureCreateProjectBuilderis always referencedregexSymbollookup toRegisterCompilationStartAction(fetched once per compilation, not per method)foreachattribute loop withmethod.HasAttribute(generatedRegexAttributeSymbol)helper💡 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.