-
Notifications
You must be signed in to change notification settings - Fork 349
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
fix ArgumentNullException exception when loading invalid CSDL #2918
base: release-7.x
Are you sure you want to change the base?
Conversation
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Hi @quanterion. Thank you for your pull request contribution. Could you please add a test to confirm the behaviour resulting from your change? |
|
||
if (!this.HasIntolerableError()) | ||
if (!this.HasIntolerableError() && parsed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have tests covering both parsed is true and false ?
@quanterion Add tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests
When loading invalid CSDL model via
CsdlReader.Parse we get correct exception EdmException. But if we do it via CsdlReader.TryParse with ignoreUnexpectedAttributesAndElements option enabled we get instead System.ArgumentNullException: Value cannot be null. (Parameter 'key') because adding null version fails here https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Edm/Csdl/CsdlReader.cs#L339 and as get no critical errors due to https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Edm/Csdl/CsdlReader.cs#L483