Skip to main content

The .NET Framework can't count past 256

Anyone who did arts in university can stop reading now.

For the most part, I really like developing .NET applications. I think Microsoft has done a fairly good job at making a framework that's pretty nice to use. But there are some things that just piss me the fuck off.

A case in point: I'm not sure how many people know this, but there is a maximum length for a file's path; actually, there's two maximum lengths. The FAT filesystems (FAT16, FAT32) had a limit of 256 characters. Remember the days of 8.3 filenames? You'd have to nest a file fairly deep in a folder hierarchy to get to 256 characters. With the advent of Windows NT, and subsequently windows 2000 and XP, they came up with NTFS, the NT filesystem. Since this filesystem natively supported long filenames, not the silly ~1 kludge that 95, 98, and ME bore, 256 suddenly became not such a hard length to hit. They upped the maximum path length to 32768 characters. That ought to be enough for everyone, right? I still don't know who in their right mind would want to type 32k of characters to get to a file :)

My problem is that the .NET framework, now in its 2.0 incarnation, and I'm pretty sure working only on operating systems that use NTFS, cannot access a file with a path longer than 256 characters. There has been a way to access these long paths since around 1997 in Windows NT 3.51, yet here in 2006 we can't seem to get past 256 characters. This made me want to kick a framework developer square in the juniper berries.

Originally posted on Friday, 2006-04-07 at 22:04:37.