I got a defect from QA today saying that our product was unable to track files in paths containing Unicode characters. I’ll admit that I was skeptical. I had just tried that myself the other day and it worked perfectly. Trying it again today also worked perfectly, but the QA engineer showed me otherwise.
System.ComponentModel.BackgroundWorker class makes it easy to code a long running operation with the ability to provide progress, cancellation, and notification of completion. It is particularly nice for UI because while the long running operation executes on a thread pool thread, notifications of progress and completion are marshalled back to the “main” thread. (When I say “main” thread, I mean the one on which
BackgroundWorker.RunWorkerAsync() is called.)
I have a little backup program that I wrote that includes the ability to shut down the machine when a backup is complete. I wanted to add the option of putting the machine to sleep instead of shutting down, but it took me a while to figure out how to accomplish this.
At work we had a long-running .NET process whose memory usage seemed to be going up, but not coming down. In investigating, I learned a few things about leak hunting, and ultimately tracked down perhaps the most insidious leak I’ve ever seen.
The .NET XML serialization support is pretty cool — I’ve used it for a few projects now. It provides an easy way to convert objects with properties to and from XML. The implementation dynamically generates a serialization assembly to do this at runtime, so a recommended strategy for improving runtime performance is to generate your serialization assemblies in advance using the XML Serializer Generator Tool (Sgen.exe).
I ran into a kind of baffling problem. I’ve got some .NET code that is also accessible to Java via JNI. There are unit tests for the .NET code that all pass. To test the Java to .NET connection, I wrote a few JUnit tests which worked fine when run from the IDE, but failed when run from Ant. The failure was ultimately caused by an ArgumentException when creating an XmlSerializer.
I always have a hard time keeping straight all the possible ways of getting an assembly’s name and what form the various methods return. Here’s a little program and its output for a reference.
I’ve been working on a context menu handler shell extension in C# lately. There are a few samples that people have produced on the web (for example, The Code Project, pek.com, and TheServerSide.net). I’ve found a better way of implementing
IShellExtInit.Initialize than in the examples I’ve seen.