Skip to content

Comments

Address archboard feedback#38403

Merged
m-nash merged 10 commits intomainfrom
mnash-archboardFeedback
Aug 31, 2023
Merged

Address archboard feedback#38403
m-nash merged 10 commits intomainfrom
mnash-archboardFeedback

Conversation

@m-nash
Copy link
Member

@m-nash m-nash commented Aug 28, 2023

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.

@m-nash m-nash requested a review from tg-msft as a code owner August 28, 2023 23:01
@azure-sdk
Copy link
Collaborator

azure-sdk commented Aug 28, 2023

API change check

APIView has identified API level changes in this PR and created following API reviews.

Azure.Core
Azure.ResourceManager

Co-authored-by: Jesse Squire <jsquire@microsoft.com>
@m-nash m-nash enabled auto-merge (squash) August 31, 2023 18:43
@m-nash m-nash merged commit ca77f0a into main Aug 31, 2023
@m-nash m-nash deleted the mnash-archboardFeedback branch August 31, 2023 19:14
{
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)!;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QQ: Do we actually know that ModelSerializer.Deserialize will never return null in this case? Is it because it would throw an exception?

Copy link
Member Author

@m-nash m-nash Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants