Advanced resource debugging with Resview

In an earlier blog about resource fallback essentials, I said that the resource diagnostic tool resview is included with the framework sdk. That was wrong – it turns out we previously released resview as a gotdotnet sample, but it’s no longer accessible. Since resview is helpful in our own investigations, we decided to re-release resview…


Cleaning up after yourself (Dispose(void) doesn’t get called for you)

Despite my large and growing number of Dispose-related blogs, I really don’t like writing about Dispose. Or rather, I don’t like that Dispose is in such a confusing state that it requires so much reading material. 🙂 But here we are again. I’d like to start posting some of the common Dispose questions I get,…


What does the NeutralResourcesLanguageAttribute do?

NeutralResourcesLanguageAttribute marks the neutral culture for an assembly. That sounds self-referential, but a full description would require another blog post. To avoid getting bogged down, think of neutral culture roughly as the default language. (Fingers crossed that Michael Kaplan doesn’t flame me for that oversimplification.) The NeutralResourcesLanguageAttribute does two things: 1. Can speed up resource probes. First…


Making a StreamWriter usable even after given garbage characters

I recently got a question from a customer using a StreamWriter with a UTF-8 encoding. The StreamWriter threw an EncoderFallbackException on an attempt to write “garbage” Unicode characters. For example, on an attempt to write U+DFC9, which is only half of a Unicode character (not a complete surrogate pair) an EncoderFallbackException was thrown. That part seemed fine…


When to call Dispose

A recent internal email thread unearthed extreme differences of opinion about when Dispose(void) should be called on an IDisposable. This led to a long discussion and a realization that — while it seems like we’ve said everything there is to say about Dispose — it’s time for some more Dispose guidance. This blog summarizes our…


FileSystemWatcher doesn’t fire events for monitored network drive after changing InternalBufferSize

  Problem and .NET Fix Some customers have observed that a FileSystemWatcher monitoring a network drive fails to fire events after setting InternalBufferSize to certain values. The problem is that the value provided to InternalBufferSize is invalid and FileSystemWatcher attempts to notify your error handler when you enable raising events, but without an error handler…


VisualStudio 2008 install failing because of pre-release products

I can get my work machines into pretty odd states due to various private/beta versions of Microsoft products I’ve installed. While trying to install VS 2008 on one of my machines, install kept failing, saying I had a pre-release product installed. Problem was, I’d already uninstalled that product and it didn’t show up in Add/Remove…


Difference between Disposing and Finalizing (referral)

I’ve gotten some pings on the difference between Disposing and Finalizing, which I didn’t discuss in my Dispose/Close post. Fortunately Brian Grunkemeyer has written an excellent blog on the topic:  


The never-ending saga of Close/Dispose

I made some quick updates in my recent post to describe the difference between Close and Dispose for SqlConnection: If you’re wondering about the difference between Close and Dispose for classes I didn’t mention, feel free to comment. I’m curious to unearth any other occurrences.


The (often non-) difference between Close and Dispose

Some classes in the .NET framework, such as System.IO.FileStream, have both a Close() and Dispose() method. The natural question is what’s the difference, and when you should use one versus the other. The framework guidelines refer to Close and Dispose in the following context: occasionally you may prefer to use a domain-specific word instead of…