2 ms·
I found this interesting, because I had just implemented a REST client that used a single HttpClient for its entire lifecycle, mostly for convenience. It's goo
by douche 10y ago
I found this interesting, because I had just implemented a REST client that used a single HttpClient for its entire lifecycle, mostly for convenience. It's good to know I probably shouldn't go back through and change that design.
IDisposable kind of sucks. Unless you know the inner workings of whatever implements it, it's hard to know how to handle lifecycles and how important properly disposing is. Is it wrapping a heavyweight COM object that is going to leak memory badly? Is it going to tie up limited system resources? Or is it a lightweight .NET object that someone has abused the interface to perform some trivial cleanup operations? There's no real guarantees.
- pixelbath 10y agoWith regard to your comment about IDisposable, I just fixed a bug caused by some wrapped pointer code de-allocating in a Dispose() method. While I thought I broke the code by simply changing the framework, it turns out this error was occurring all the time, but only cropped up because .Net 4 treats Corrupted State Exceptions (CSEs) differently and doesn't catch them by default. I was shocked that the answer was "the library you've been using for 6 years is crap."