Conversation
Collaborator
|
API change check APIView has identified API level changes in this PR and created following API reviews. |
jsquire
approved these changes
Aug 30, 2023
sdk/core/Azure.Core/src/Serialization/AbstractTypeDeserializerAttribute.cs
Outdated
Show resolved
Hide resolved
sdk/core/Azure.Core/src/Serialization/ModelSerializerOptions.cs
Outdated
Show resolved
Hide resolved
sdk/resourcemanager/Azure.ResourceManager/src/Common/Custom/Models/TrackedResourceData.cs
Show resolved
Hide resolved
Co-authored-by: Jesse Squire <jsquire@microsoft.com>
christothes
approved these changes
Aug 30, 2023
…ure-sdk-for-net into mnash-archboardFeedback
Co-authored-by: Christopher Scott <chriss@microsoft.com>
…n't implement interface
annelo-msft
reviewed
Aug 31, 2023
| { | ||
| using JsonDocument document = JsonDocument.ParseValue(ref reader); | ||
| return (IModelJsonSerializable<object>)ModelSerializer.Deserialize(BinaryData.FromString(document.RootElement.GetRawText()), typeToConvert, ModelSerializerOptions); | ||
| return (IModelJsonSerializable<object>)ModelSerializer.Deserialize(BinaryData.FromString(document.RootElement.GetRawText()), typeToConvert, ModelSerializerOptions)!; |
Member
There was a problem hiding this comment.
QQ: Do we actually know that ModelSerializer.Deserialize will never return null in this case? Is it because it would throw an exception?
Member
Author
There was a problem hiding this comment.
It can return null in fact I have a test case here that asserts we get back null. The ! at the end of the line here is required because I cannot make Read return nullable since its an overridden function and the base class doesn't define it with a ?. In the event the ModelSerializer returns null the line is equivalent to (IModelJsonSerializable<object>)null which does work fine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses comments from this review https://apiview.dev/Assemblies/Review/77bdbcef49a3465fa96fac3fb745bf57/46bfc5d6a1cc4af68b69502f6612548c?diffRevisionId=c53fffb104884669addf0e6c1fdfd4d2&doc=False&diffOnly=True#Azure.Core.Serialization.ObjectSerializer
Contributing to the Azure SDK
Please see our CONTRIBUTING.md if you are not familiar with contributing to this repository or have questions.
For specific information about pull request etiquette and best practices, see this section.