XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.ServerInteractive

[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.ServerInteractive

fix: report XFE0012 diagnostic on all duplicate path occurrences (not just second)

Agent-Logs-Url: https://github.com/XFEstudio/XFEExtension.NetCore.ServerInteractive/sessions/0bdd5cc2-db83-4424-ba4b-914b3786e270 Co-authored-by: XFEstudio <132526994+XFEstudio@users.noreply.github.com>

d08873f
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
提交于

代码差异

1 个文件 +18 -5
Modified XFEExtension.NetCore.ServerInteractive.SourceGenerator/EntryPointGenerator.cs +18 -5
@@ -217,17 +217,30 @@ public class EntryPointGenerator : IIncrementalGenerator
217 217
218 218 // 检查重复路径(路径相同的任意两个方法都报错,无论同步/异步)
219 219 var hasDuplicateError = false;
220 var seenPaths = new HashSet<string>();
220 var pathToMethods = new Dictionary<string, List<MethodCandidate>>();
221 221 foreach (var method in methodInfos)
222 222 {
223 if (!seenPaths.Add(method.Path))
223 if (!pathToMethods.TryGetValue(method.Path, out var list))
224 {
225 list = new List<MethodCandidate>();
226 pathToMethods[method.Path] = list;
227 }
228 list.Add(method);
229 }
230
231 foreach (var kvp in pathToMethods)
232 {
233 if (kvp.Value.Count <= 1)
234 continue;
235
236 hasDuplicateError = true;
237 foreach (var dup in kvp.Value)
224 238 {
225 239 context.ReportDiagnostic(Diagnostic.Create(
226 240 DuplicatePathRule,
227 method.MethodLocation.ToLocation(),
228 method.Path,
241 dup.MethodLocation.ToLocation(),
242 kvp.Key,
229 243 className));
230 hasDuplicateError = true;
231 244 }
232 245 }
233 246