Use `ObjectDisposedException.ThrowIf` in more places
See original GitHub issueIs your feature request related to a problem? Please describe
ObjectDisposedException.ThrowIf
was introduced in .NET7, we should make use of it in more places.
https://learn.microsoft.com/en-us/dotnet/api/system.objectdisposedexception.throwif?view=net-7.0
Describe the solution you’d like and alternatives you’ve considered
n/a
Will this feature affect UI controls?
n/a
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
c# - Using ObjectDisposedException
When implementing the Dispose pattern the object's properties should throw ObjectDisposedException after the object has been disposed. It seem ...
Read more >Add new ObjectDisposedException constructor overload
There is a very common pattern used to handle disposed object state and it involves throwing ObjectDisposedException .
Read more >ObjectDisposedException.ThrowIf Method (System)
ThrowIf (Boolean, Object) Throws an ObjectDisposedException if the specified condition is true .
Read more >UnitOfWork objects are throwing ObjectDisposedExceptions
In my error reporting lately I've been seeing a lot of ObjectDisposedExceptions where the UnitOfWork will be disposed for some random reason ...
Read more >Thread: [RESOLVED] Object Disposed Exception
Hi, I have an Object Disposed Exception, I don't know what this means. ... To say the the correct way to exit an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m with @RussKie on this one 😄. There’s nothing that promises the same message to the exception. If this only changes the ultimate message and not the exception type (which I don’t believe we are) I think we can change the messages to our hearts content.
I believe it is fully acceptable to alter the error message. I don’t believe we have ever promised to retain the same exception message. Nor it is listed in the breaking change definitions doc, nor it’s forbidden in the breaking change rule doc.