Azure / Azure/openapi-diff

Improve the error reported in the log for a NullReferenceException issue

未关闭
#362 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
290
派生
50
平均合并
5 天 13 小时
30 天内合并 PR
5

描述

The following error seems to be caused by spec issues, but it doesn't have enough information to trace the real issues.

```
Error: appendOadRuntimeErrors: {"type":"Raw","level":"Error","message":"Runtime Exception","time":"2025-08-06T20:28:16.228Z","groupName":"preview","extra":{"new":"https://github.com/stevemunk/azure-rest-api-specs/blob/ec36d0206de5a236b79e079611bcd25df47362cd/specification/maps/data-plane/Microsoft.Maps/Alias/preview/2.0/alias.json","old":"https://github.com/Azure/azure-rest-api-specs/blob/main/specification/maps/data-plane/Microsoft.Maps/Alias/preview/2.0/alias.json","details":"Command failed: dotnet /home/runner/work/azure-rest-api-specs/azure-rest-api-specs/node_modules/\\@azure/oad/dlls/OpenApiDiff.dll -o /tmp/oad-6bw2a3/old-resolved.json -n /tmp/oad-2X5zP2/new-resolved.json\nUnhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.\n at AutoRest.Swagger.Model.ServiceDefinition.ReferenceTrackSchemas(ServiceDefinition service) in D:\\a\\_work\\1\\s\\openapi-diff\\src\\modeler\\AutoRest.Swagger\\Model\\ServiceDefinition.cs:line 509\n at AutoRest.Swagger.Model.ServiceDefinition.Compare(ComparisonContext`1 context, ServiceDefinition previousDefinition) in D:\\a\\_work\\1\\s\\openapi-diff\\src\\modeler\\AutoRest.Swagger\\Model\\ServiceDefinition.cs:line 321\n at AutoRest.Swagger.SwaggerModeler.Compare(String fileNameOld, String swaggerOld, String fileNameNew, String swaggerNew, Settings settings) in D:\\a\\_work\\1\\s\\openapi-diff\\src\\modeler\\AutoRest.Swagger\\SwaggerModeler.cs:line 34\n at OpenApiDiff.Program.Main(String[] args) in D:\\a\\_work\\1\\s\\openapi-diff"}}
```

Pipeline run:
https://github.com/Azure/azure-rest-api-specs/actions/runs/16787747592/job/47542471322?pr=36493

贡献指南

打开贡献指南

调研方向

Start with ServiceDefinition.cs at ReferenceTrackSchemas line 509, then follow Compare at line 321 and SwaggerModeler.cs line 34. Reproduce the failure using the OpenApiDiff.dll command and the old/new resolved files shown in the error details. Done means the log reports enough context to trace the underlying specification problem instead of only the NullReferenceException.

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。