Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stackoverflow Exception when resolving Partners in OData contract (xml) #3114

Open
adeel2023 opened this issue Nov 8, 2024 · 0 comments · May be fixed by #3121
Open

Stackoverflow Exception when resolving Partners in OData contract (xml) #3114

adeel2023 opened this issue Nov 8, 2024 · 0 comments · May be fixed by #3121
Assignees

Comments

@adeel2023
Copy link

Parsing the attached OData contract/metadata XML file (attached as .txt file) leads to Stack overflow exception when traversing Partners. The file has complex Navigation props. structure and If all the NavigationProperty tags from the first EntityType User are removed, the file is parsed without errors.

SOE-OData-xml.txt

Assemblies affected

Initially observed on Microsoft.OData.Edm, v7.21.1 but also exists on the latest v8.0.1

Reproduce steps

Read the attached-xml file's contents and invoke CsdlReader.TryParse(...) method.

Expected result

OData contract should be parsed without errors or any errors, if encountered, should be reported gracefully rather than SOE.

Actual result

Stackoverflow exception is thrown out of CsdlSemanticsNavigationProperty.ComputePartner() every single time. A part of recursive stacktrace is given below:

 at Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty.get_Partner()
   at Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty.ComputePartner()
   at Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty+<>c.<.cctor>b__45_1(Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty)
   at Microsoft.OData.Edm.Cache`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetValue(System.__Canon, System.Func`2<System.__Canon,System.__Canon>, System.Func`2<System.__Canon,System.__Canon>)
   at Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty.get_Partner()
   at Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty.ComputePartner()
   at Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty+<>c.<.cctor>b__45_1(Microsoft.OData.Edm.Csdl.CsdlSemantics.CsdlSemanticsNavigationProperty)
   at Microsoft.OData.Edm.Cache`2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetValue(System.__Canon, System.Func`2<System.__Canon,System.__Canon>, System.Func`2<System.__Canon,System.__Canon>)

[Stacktrace goes on further repeating the same output]
@xuzhg xuzhg self-assigned this Nov 12, 2024
@xuzhg xuzhg added the bug label Nov 13, 2024
xuzhg added a commit that referenced this issue Nov 13, 2024
xuzhg added a commit that referenced this issue Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants