-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Avoid boxing in DeferredDisposableLifetime #79778
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
Conversation
|
Tagging subscribers to this area: @mangod9 Issue DetailsFixes #79774
void ThrowIf(bool condition, object instance);
void ThrowIf(bool condition, Type type);
|
|
/benchmark json aspnet-citrine-win runtime |
|
I was staring at the original PR trying to figure out what was going on 😄 |
|
cc @stephentoub |
|
Benchmark started for json on aspnet-citrine-win with runtime. Logs: link |
|
An error occured, please check the logs |
|
src/libraries/System.Private.CoreLib/src/System/Threading/DeferredDisposableLifetime.cs
Outdated
Show resolved
Hide resolved
|
Here you go
|
|
Imagine if we had an analyzer for this 😄 (https://marketplace.visualstudio.com/items?itemName=MukulSabharwal.ClrHeapAllocationAnalyzer&ssr=false#overview) cc @mjsabby |
| // Have we been disposed? | ||
| ObjectDisposedException.ThrowIf(oldCount < 0, this); | ||
| if (oldCount < 0) | ||
| throw new ObjectDisposedException(typeof(T).ToString()); |
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.
Thanks for fixing. We'll want to fix the analyzer/fixer as well to not fire in this case. But that's not pressing and I can do that when I'm back.
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.
We'll want to fix the analyzer/fixer as well to not fire in this case. But that's not pressing and I can do that when I'm back.
|
Whoa, that was a large regression due to a one line change. Are there other places which need to be looked at, since the original change had a lot more changes? |
|
I scanned through the |

Fixes #79774
thisin this case is a struct, andObjectDisposedExceptionhas two overloads