Browse by Tags

Tagged Content List
  • Blog Post: Memory Mapped File Quirks [Greg]

    Memory mapped files are segments of virtual memory that are directly mapped to a physical file on disk, byte-by-byte. This technology has a number of benefits over traditional stream based I/O, such as performance during random access to large files, or the ability to share the mapped memory between...
  • Blog Post: More on Zip in .NET [Richard Lee]

    First, I’d like to thank everybody for their comments on the Zip APIs. It’s great to know that I’m working on something that a lot of people will hopefully find useful. I’ll try to address the themes that came up in the comments. Streams A lot of the comments mentioned support for streams. The API does...
  • Blog Post: Working with Zip Files in .NET [Richard Lee]

    Before getting started, I’ll introduce myself. My name is Richard Lee, and I’m a developer intern on the BCL for the summer. I’ve only been here for a few weeks, but it’s been great working here. The people, the environment, and my project are all great. Speaking of which, my...
  • Blog Post: Long Paths in .NET, Part 3 of 3 Redux [Kim Hamilton]

    My original part 3 blog caused confusion, mostly because it didn’t tie together loose ends and explain that an immediate .NET “solution” is at best partial. To minimize confusion and answer questions in the comments, I decided to do a complete overhaul and link to the original ( here ). Win32 file...
  • Blog Post: Long Paths in .NET, Part 3 of 3 [Kim Hamilton]

    Updated 6/10/08 2:20pm: clarified details of proposed solution Here it is, Part 3 of the long path series , which started over a year ago. I apologize for leaving you hanging; the BCL team has been busy lighting up the web . Because of the delay, I’ll summarize the compatibility concerns as context...
  • Blog Post: System.IO.Compression Capabilities [Kim Hamilton]

    We often get asked about the capabilities of the .NET compression classes in System.IO.Compression. I'd like to clarify what they currently support and mention some partial workarounds for formats that aren't supported. The .NET compression libraries support at the core only one type of compression...
  • Blog Post: Long Paths in .NET, Part 2 of 3: Long Path Workarounds [Kim Hamilton]

    For now, our suggested workaround for users that encounter the MAX_PATH issue is to rearrange directories so that the names are shorter. This may sound like a cop out, but this is ultimately easier on users because of (1) limited tool support (i.e. Explorer doesn't work with long paths) and (2) getting...
  • Blog Post: Long Paths in .NET, Part 1 of 3 [Kim Hamilton]

    Let’s start by looking at one of the more interesting exception messages in the BCL, the PathTooLongException: [PathTooLongException]: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters...
  • Blog Post: Introducing Pipes [Justin Van Patten]

    The Orcas October Community Technology Preview (CTP) includes new types that make it easy for developers to use pipes from managed code. Pipes are used for inter-process communication (IPC) between processes running on the same machine, or processes running on any other Windows machine within a network...
  • Blog Post: Top 5 SerialPort Tips [Kim Hamilton]

    The SerialPort class requires some “warming up” time for our users coming from VB6 or other non-.NET backgrounds. One of the main reasons is that SerialPort and its underlying BaseStream are designed to behave similarly to other .NET streams, which (for example) means that Read() may not act as you’d...
  • Blog Post: FileInfo.LastWriteTime discrepancies [Lakshan Fernando]

    I recently investigated a customer issue of incorrect time reporting with FileInfo.LastWriteTime and thought of sharing this information in the blog. In the customer case, the last write time was off by about one hour for some files. We depend on two Win32 APIs to get the file time information...
  • Blog Post: SerialPort Encoding [Ryan Byington]

    The SerialPort class uses the encoding specified by the SerialPort.Encoding property to convert strings and character arrays to bytes to send across the serial port. This encoding also gets used when reading from the serial port to convert bytes received by the serial port to strings and character arrays...
  • Blog Post: SerialPort and DataReceived Event [Ryan Byington]

    I have seen a few customers complain that their DataReceived event handler was never getting called and I thought I would share their problems here so you can learn from their mistakes. The problems revolve around the port not being open. This is sometimes as obvious as not calling SeiralPort.Close if...
  • Blog Post: Using a MemoryStream with GZipStream [Lakshan Fernando]

    We’ve seen cases where our customers have run into issues when using a MemoryStream with GZip compression. The problem can be frustrating to debug and I thought I’ll blog about it in the hope that others would avoid a similar issue. The code for this looks like this; Byte [] compressedBuffer; ...
  • Blog Post: Using FileStream from Restricted User Accounts [Josh Free]

    Every so often, I run into code that requests security permissions that are not needed. Take the following code snippet as an example: // open the file for reading FileStream fs1 = new FileStream ( @"C:\Program Files\SomeFile.bin" , FileMode .Open); From the code comment...
  • Blog Post: Reading a file in Managed Code [Lakshan Fernando]

    Some of our new users to managed code take a little time to get used to the design pattern in reading a file. I thought I’ll enumerate through the most common patterns for their benefit; Reading from a FileStream : Create a suitable buffer size – the default internal buffer size is 4k for a FileStream...
  • Blog Post: Using GZipStream for Compression in .NET [Brian Grunkemeyer]

    One of the cool new features in Whidbey is a GZipStream class, which supports GNU's zip utility (gzip). For anyone with a Unix background, you've had to come across .tar.gz or .tgz files as you deal with the tedium that accompany downloading new source code & compiling new binaries for your Linux...
  • Blog Post: How to set MACL from one directory to another? [Ravi Krishnaswamy]

    A correct way to do this will be as follows: // Get DirectorySecurity from source directory DirectorySecurity dsSrc = Directory.GetAccessControl(srcPath, AccessControlSections.Access); // Transfer ACL security descriptor byte[] sdBinary = dsSrc.GetSecurityDescriptorBinaryForm(); DirectorySecurity dsDst...
  • Blog Post: DirectoryInfo.Name lacks security checks [Ravi Krishnaswamy]

    This came out of one of our internal security review. I thought I would post it here for beware sake. DirectoryInfo’s Name property currently requires no permission checks in and of itself, though you do need Read permission to construct a DirectoryInfo in the first place. DirectoryInfo’s FullName property...
  • Blog Post: IO Exceptions will now reveal FullPath (if you have PathDiscovery access) [Ravi Krishnaswamy]

    You might start noticing that in Whidbey Beta2, IO exceptions are handing out full qualified path which was previously regarded as secure information. Well, don’t be alarmed . This information is still secure and let me explain how. IO classes often take in relative path (for ex, DirectoryInfo) but when...
  • Blog Post: Testing Managed ACL for IO [Lakshan Fernando]

    One of the common requests we had after we shipped V1.1 was on managed ACL support for the Framework. We’ve added comprehensive ACL support in V2.0. This was a cross-group effort with multiple teams working on this feature; the windows core security team provided the base definitions and the interoperability...
  • Blog Post: Fixing bugs with compatibility in mind - an IO experience [Lakshan Fernando]

    The current focus on the team is bug-fixing, but every so often we get a bug that may cause compatibility issues if we fix it. I thought I would share one such recent scenario where, because the gain doesn’t seem significant enough, we’re currently choosing to stick with the V1.1 behavior. Note that...
  • Blog Post: Issues with Console APIs when stdout is redirected to a file [Ravi Krishnaswamy]

    When you redirect stdout of your consoleapp to a file, you can expect that a number of Console APIs won't work quite right. For ex, MoveBufferArea is an obvious candidate of something that can't be supported. In this situation you will get an IOException saying that the handle is invalid or something...
  • Blog Post: Path.GetDirectoryName [Ravi Krishnaswamy]

    Clarifying the behavior of Path.GetDirectoryName. This is a convenient string parsing method to get the directory path of a file path. It validates neither the given file path nor the returned directory path. This method merely removes the last element of the given file path, i.e. it returns a string...
  • Blog Post: FileStream internal buffer and some non-intuitive behavior [Ravi Krishnaswamy]

    I recently came across a bug in FileStream’s internal buffer where the behavior is non-intuitive, so I thought I would discuss it. Filestream uses one internal buffer for both reading and writing (scary but memory efficient). Unfortunately, this means you need to understand the behavior to avoid some...
Page 1 of 2 (31 items) 12