-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 OverflowException in JsonSerializer.Serialize - Part 2 #34040
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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.
Such NoInlinings aren't necessary on .NET Core, and could make things worse. I assume these are here for the NuGet package builds? Not for this change, as you're just following the rest of these, but it seems like we should subsequently remove all of them.
cc: @steveharter
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.
Just out of curiosity, there is any issue/docs about it? I'd like to know more about it.
If I remember correctly the reason to use ThrowHelper was to reduce code size
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.
The JIT in dotnet/runtime won't inline a method like this that always throws, anyway. But marking it as NoInlinining means that the JIT won't even look at the method implementation from the caller, which means it also won't see that the method never returns, which means the call site ends up accounting for the fact that it may, unnecessarily.
https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIAYACY8gOgCUBXAOwwEt8YLAMIR8AB14AbGFADKMgG68wMXAG4aNYgGYmpBkIYBvGgzNNdxFAwCy5ABQRgAKxhgMDCAEpT5k9XNAhl4AMwZHYNwGLg5JSS8GABUACygIAHdcAHVeDGSIDgwAOQgASS5JXi4qgHN7Lw0AoLNmAE5HBt8zAF8uhj6dJmsbUkcXNw9vPv9ms1DwiEjo2Pik1Izs3OSS8srqrjrOpua2jsbA3uP+q7EoXgVsDBgmciQhtbTMnLyC4rKKqq1eoMAC8AD4GHlPtEYOkGABRBAqMR8CBcerncx9ADaNhgPwAJqVxJJ7HjCcSxJIAPIo3ho3AsHYA/Y1LwAXT6t3uj2ezDeVg+G2+23+eyBCXBkPWcK4sIRSJgdLRGJo3SAA==
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.
Should we create a issue to keep track of this?