Articles tagged with .NET

Unicode Surprises

By Eric — 2 minute read

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 …

Read more...

.NET BackgroundWorker Summary

By Eric — 3 minute read

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 …

Read more...

Sleep Mode from .NET

By Eric

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 …

Read more...

Finding Unmanaged Memory Leaks

By Eric — 5 minute read

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.

My first approach was to try to profile …

Read more...

Generating XML Serialization Assemblies

By Eric — 2 minute read

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 …

Read more...

ArgumentException Creating an XmlSerializer

By Eric — 2 minute read

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 …

Read more...

Assembly Names

By Eric — 1 minute read

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.

class Program 
{ 
    static void Main(string[] args) 
    { 
        Assembly assembly = Assembly.GetExecutingAssembly(); 
        Console.WriteLine("Assembly.ToString()           : {0 …

Read more...

.NET Context Menu Handler

By Eric — 3 minute read

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 …

Read more...