Geeks With Blogs
Chris Falter .NET Design and Best Practices .NET Gotchas If you're like me, you regularly encounter those "gotchas" with the .NET Framework. They might happen because the documentation is poor, or you assumed something you shouldn't have, or even, on the rare occasion, because Microsoft's implementation is kludgey. When I encounter a gotcha, I'll post a word to the wise here so you can avoid it.
Of Sobriety Tests and Loop Iteration

A skill that is useful during traffic stops can also help you write correct loop iterations.

Posted On Thursday, November 8, 2007 5:44 AM

Website Projects and Windows Authentication: a Volatile Mixture

As any fourth-grader who has ever attended a science fair can tell you, all you have to do is mix vinegar and baking soda to create a volcano that will spill lots of red, flowing "lava" all over your kitchen tile. Today one of my colleagues inadvertantly created a code volcano when he incorrectly mixed Windows authentication with an ASP.NET 2.0 website project....

Posted On Friday, November 2, 2007 10:01 AM

Do *NOT* Set up a Reparse Point for the Windows\Assembly Folder!

In order to free space on the system partition, we moved a variety of directories from drive C to drive D, and then used the Junction utility from SysInternals (now owned by Microsoft) to create reparse points on drive C that pointed to the new file locations on drive D. Unfortunately, the party ended when we tried to relocate the GAC...

Posted On Monday, July 16, 2007 8:31 AM

How To: Write a Unit Test for Multi-Dimensioned Output
One of the cool features of Visual Studio 2005 is that it can generate a unit test stub for a class or method. However, I recently discovered that the Unit Test plug-in does not know how to auto-generate an assertion for a method whose output includes a multi-dimensioned out parameter or return value. Here's the relevant stub code that VS 2005 generated for one of my methods whose output includes a multi-dimensioned array: // generated code that creates a class instance called "target", plus other ......

Posted On Friday, May 4, 2007 8:42 AM

More on How To Re-throw an Exception
Re-throwing an exception is a little more complex that I had realized. The gotcha, pointed out by helpful reader "Sander", is that when the initial exception is thrown from directly inside the try block, rather than from within a method call inside the try block, you will lose the line number of the faulty line of code, regardless of how you re-throw the exception. Here's some sample code that demonstrates what I mean: using System;namespace RethrowExTest{ class Program { static void Main(string[] ......

Posted On Wednesday, March 28, 2007 4:37 PM

How To: Re-throw an Exception
I've coached many youth baseball teams, and I've always put a lot of focus on developing pitchers. Your left fielder can be chasing butterflies, and the right fielder might have his glove off, and the third baseman can be making faces at his sister in the stands...but if the guy on the mound is mowing 'em down, your odds of winning are pretty good. To the uninitiated, pitching looks easy, but in fact it is one of the most difficult skills in all of sports. To throw a baseball with both force and ......

Posted On Thursday, December 7, 2006 6:31 PM

Visual Studio Team Server, the Gangly Adolescent
As a high school sophomore I was 6'1“ tall and 140 pounds--a human bean pole. My arms shot out of my sleeves like beanstalks in Jack's garden. You could practically see my ankles emerging from the bottom of blue jeans as I stood before you. As a physical specimen, though, you could see on my frame what I would eventually become as an adult, after a little more maturation. I was a gangly adolescent. I'm almost delirious that Microsoft finally released Visual Studio Team Server (VSTS), especially ......

Posted On Thursday, August 24, 2006 11:44 PM

VS 2005 Gotcha: Project Loading When Opening Solution from Source Control
We have invested a lot of effort into making the file paths for our projects mirror the SourceSafe project hierarchy, per the long-standing Microsoft “Team Development” whitepaper (especially chapter 3). The initial solution developer, typically the team lead, creates a blank Visual Studio solution, then adds the various projects at the solution root. To illustrate, here's the directory structure from a solution I created recently: After the solution is checked in to source control, the ......

Posted On Monday, April 3, 2006 7:36 PM

How To: Modify an Existing Xml File
The past couple of days I've been working on a command-line config file parser that will enable our build process to emit the correct web.config for any given environment. For example, we define environments called “model,” “fqa” (final qa) and “prod” (production). The idea is to embed the environment-specific settings in comments at the end of the web.config file, then run the parser, passing in the environment name as a command-line parameter. Here is a sample of what the environment-specific settings ......

Posted On Monday, March 27, 2006 6:30 PM

The Literary Ambitions of the ASP.NET 2.0 Site Compiler
In previous versions, ASP.NET considered the web.config file to be untouchable. What you, the developer, wrote into the file may as well have been engraved like the Ten Commandments into stone tablets. But under the new compilation model, ASP.NET wants to collaborate with you in authoring the web.config file. Specifically, during site compilation, it will insert lines into the /configuration/system.web/c... element to make sure that the runtime JIT compiler knows how to link to ......

Posted On Friday, April 28, 2006 8:39 PM

Exceeding the Wildest Dreams of the Microsoft Marketing Department
The marketing gurus at Microsoft singlehandedly support a half dozen Starbucks franchises, no doubt, as they prime their adrenaline pumps to concoct Yet Another Plug (YAP) for the virtues of the .NET Framework. "Write more functionality with 80% less code!", they shout. As a heartfelt idealist, I take these claims seriously, so I have been looking for evidence to support the yapping. Recently, I achieved a wondrous breakthrough that will cheer the Redmond lads and lassies and leave the Java crowd ......

Posted On Friday, April 21, 2006 2:07 PM

Copyright © Chris Falter | Powered by: GeeksWithBlogs.net