microsoft / microsoft/OpenAPI.NET.OData
Microsoft.OData.Edm 9.0.0-rc compat: MissingMethodException on ExtensionMethods.GetReturn(IEdmOperation)
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 240
- フォーク
- 70
- 平均マージ
- 7時間 59分
- マージ済み PR(30日)
- 13
説明
Summary
Microsoft.OpenApi.OData.Reader 3.2.1 throws System.MissingMethodException at runtime when used with Microsoft.OData.Edm 9.0.0-rc. The published 3.x assembly has IL that calls Microsoft.OData.Edm.ExtensionMethods.GetReturn(Microsoft.OData.Edm.IEdmOperation), but that extension method was removed in OData/odata.net@10c65053e and is therefore absent from the Microsoft.OData.Edm 9.0.0-rc NuGet package.
Affected versions
| Package | Version | Status |
|---|---|---|
Microsoft.OpenApi.OData |
3.2.1 (latest 3.x) | Calls GetReturn |
Microsoft.OData.Edm |
8.4.3 | Has GetReturn — works |
Microsoft.OData.Edm |
9.0.0-preview.3 / preview.4 | Missing GetReturn — breaks |
Microsoft.OData.Edm |
9.0.0-rc | Missing GetReturn — breaks |
Microsoft.OData.Edm |
main (post-9.0.0-rc) | GetReturn restored in OData/odata.net@e375dd74e |
Repro
Any model that produces at least one IEdmOperation path (entity sets are enough to make ODataPathProvider.RetrieveBoundOperationPaths walk the operation paths it accumulated and evaluate the _allOperationPaths.Where(...) lambda that calls GetReturn).
var model = builder.GetEdmModel();
var doc = model.ConvertToOpenApi(new OpenApiConvertSettings());
Exception
System.MissingMethodException: Method not found: 'Microsoft.OData.Edm.IEdmOperationReturn Microsoft.OData.Edm.ExtensionMethods.GetReturn(Microsoft.OData.Edm.IEdmOperation)'.
at Microsoft.OpenApi.OData.Edm.ODataPathProvider.RetrieveBoundOperationPaths(OpenApiConvertSettings convertSettings)
at Microsoft.OpenApi.OData.Edm.ODataPathProvider.GetPaths(IEdmModel model, OpenApiConvertSettings settings)
at Microsoft.OpenApi.OData.Edm.ODataContext.LoadAllODataPaths()
...
at Microsoft.OpenApi.OData.EdmModelOpenApiExtensions.ConvertToOpenApi(IEdmModel model, OpenApiConvertSettings settings)
Root cause
OData/odata.net PR 10c65053e ("Add 'ReturnType' default interface property into IEdmOperation, remove 'GetReturn' extension method", Nov 6, 2025) removed the static extension and added a ReturnType default interface member on IEdmOperation instead. The replacement is operation.Return (returns IEdmOperationReturn) — semantically equivalent, but a binary break for callers compiled against 8.x.
That removal shipped in 9.0.0-rc (May 5, 2026). The following day, OData/odata.net@e375dd74e brought GetReturn back as a back-compat extension on top of IEdmOperation.Return, so the next Edm 9.x release after 9.0.0-rc should restore source/binary compatibility with the existing OpenApi.OData 3.x release.
Disassembled callsites in Microsoft.OpenApi.OData.Reader.dll 3.2.1 (8 occurrences in total):
ODataPathProvider.RetrieveBoundOperationPaths(lambda over_allOperationPaths+ body)EdmOperationExtensions(operation-import path enumeration)OperationHandler.AppendSystemQueryOptions(IEdmFunction)EdmModelHelper.VisitOperation- … and a few more in schema-generation paths.
Ask
- Confirm 3.x will pick up the next Edm 9.x release (post-9.0.0-rc) once it ships with
GetReturnrestored. - Plan a 4.x preview of
Microsoft.OpenApi.ODatathat migrates theGetReturn(...)callsites to the newIEdmOperation.Returnmember, so consumers can target Edm 9.x without depending on the back-compat shim. Bumping theMicrosoft.OData.Edmdependency from>= 8.4.3to>= 9.xwould also unblock consumers from forcibly overriding the floor (which is what surfaces this bug today).
Workaround
For consumers wedged against Edm 9.0.0-rc, the only options are (a) pin Microsoft.OData.Edm back to 8.x, or (b) wait for the next Edm 9.x release where GetReturn is restored.
Happy to PR step 2 if useful — let me know if there's an existing branch or design preference.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
model.ConvertToOpenApi の repro から始め、ODataPathProvider.RetrieveBoundOperationPaths、EdmOperationExtensions、OperationHandler.AppendSystemQueryOptions、EdmModelHelper.VisitOperation を調査します。報告された 8 つの GetReturn 呼び出し箇所を追跡し、Edm 9.x の互換性への影響を確認します。完了の条件は、互換性動作と依存関係のバージョン変更が確認された、4.x への移行計画または IEdmOperation.Return を使用する実装です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp
- 領域
- api, backend-api-design
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100