Random Post: Automated Testing
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About
  • Eric’s Toolset
  • Free Software
  • Software License
  •  

    .NET Cold Startup Performance: An Example

    March 6th, 2008

    When running a .NET application for the first time after rebooting or hibernating the computer, you might find that it takes a long time to start up. I’ve been trying to address this problem in a few situations recently. In spite of having read several articles on the subject, I wasn’t having much success. Following some of the advice gave no noticeable improvement, and some (like using NGEN) actually slowed down startup. But I had some success recently, so I thought I’d explain how.

    Read the rest of this entry »


    Why StringComparison.Ordinal Is Usually the Right Choice

    October 15th, 2007

    A question that arose in response to my previous post (about how string comparisons can produce unexpected results when done in a culture-sensitive way) was Which is right, StringComparison.Ordinal or StringComparison.InvariantCulture? The short answer: StringComparison.Ordinal.

    Read the rest of this entry »


    Unicode Surprises

    October 11th, 2007

    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.

    Read the rest of this entry »


    .NET BackgroundWorker Summary

    October 10th, 2007

    The 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.)

    Read the rest of this entry »


    Temporary CommandBar Customizations in Word

    September 4th, 2007

    It’s common for an Office add-in to put some custom menu items or toolbar buttons in the UI of the hosting application. The method to call to do this is CommandBars.Add. It is also typical that you’d like those customizations to appear so long as the add-in gets loaded, but not appear if it doesn’t. If your add-in gets uninstalled, for example, you clearly don’t want left-over customizations littering the application. For this reason, the Add method’s final parameter is a boolean that indicates whether a particular added control should be added temporarily. The documentation describes the parameter like this:

    Temporary
    Optional Object. True to make the new control temporary. Temporary controls are automatically deleted when the container application is closed. The default value is False.

    This looks perfect. You can add the customizations at startup, and they’ll be gone at shutdown… except that it doesn’t work in Word.
    Read the rest of this entry »


    Sleep Mode from .NET

    August 29th, 2007

    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.

    Read the rest of this entry »


    Finding Unmanaged Memory Leaks

    June 25th, 2007

    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.

    Read the rest of this entry »


    Generating XML Serialization Assemblies

    June 13th, 2007

    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).

    Read the rest of this entry »


    ArgumentException Creating an XmlSerializer

    May 26th, 2007

    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.

    Read the rest of this entry »


    Naming Private Fields (Addendum)

    January 30th, 2007

    This is just a quick addition to the previous posting, confirming the alleged use of m_ by Microsoft in their own code. Read the rest of this entry »