February 2004 - Posts

Parsing a Solution File

There's a new challenge up at Code Blog.  This time the tests are for something a little more real.  The aim is to parse a Visual Studio SLN file.  I admit to having a vested interest in some code to do this.  I am sick to death of poluting my test code with explicit knowledge of where project output directories are located ('bin\Debug' or whatever).  I really want to reference my project directories by name.  For example, 'Projects.Find("MyProject").BaseDirectory'.

To to this I need to be able to locate and parse solution files.  I hope people find this potentially useful enough to submit a few entries.  I do have some working code, but I'm interested to see how other people go about tackling it.  So please, subscribe to the feed and make your submissions!

Posted by Jamie Cansdale | 5 comment(s)
Filed under:

ASP.NET's Configuration System

Have you ever wondered how ASP.NET installs its fancy 'Web.config' configuration system?  Well, here it is...

HttpConfigurationSystemBase configSystem = new HttpConfigurationSystem();
MethodInfo method = typeof(ConfigurationSettings).GetMethod("SetConfigurationSystem", BindingFlags.NonPublic);
method.Invoke(null, new object[] {configSystem});

It uses refection to call a private method.  I didn't expect to find that!

Sandboxing code dynamically

I have found a good article on Ivan's blog on the proper way to sandbox code.

I have been getting questions from people about how to make a piece of managed code execute in a security restricted environment, or how to "sandbox" it. Some people are trying to use stack walk modifiers (such as Deny()) to do it, which does not work for this purpose.

I'm afraid I fell into this trap.  I thought if I denied everything (including the permission to Assert) I would be pretty safe.  Does anyone know why this doesn't work?  I will have to do some experiments.

New Test

There's a new set of unit tests over at Test Driven .NET.  Thanks to Johan Danforth for being our first 'test driver'.  Hopefully this one will show there are many ways to skin a cat.  Once there are enough submissions up, I am hoping to graph them (maybe using Jonathan de Halleux's NPerf recently posted on Code Project).

I've now made it easy to download your code and work offline.  I've also added a pseudo XML doc tag <references> to make to make the code more self contained.  Maybe Jeff would consider adding support for this to Snippet Compiler?

Subscribe to the feed and get your submissions in!  New sets of tests are always welcome.  Please let me know if you gave any ideas.

Posted by Jamie Cansdale | 1 comment(s)
Filed under:

clientScriptsLocation

Donny Mack shows us how to specify the 'aspnet_client' directory in your Web.config.  I'm sure this will come in useful soon (I'm playing the Cassini web server).
Posted by Jamie Cansdale | with no comments
Filed under:
More Posts