question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use `ObjectDisposedException.ThrowIf` in more places

See original GitHub issue

Is 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:closed
  • Created 10 months ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
merriemcgawcommented, Nov 18, 2022

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.

1reaction
RussKiecommented, Nov 16, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found