Tuesday, May 18, 2004

Managed DPAPI Part I: ProtectedData

Shawn Farkas shows how to use the new Managed DPAPI in

  • Part I: ProtectedData
  • Part II: ProtectedMemory.

  • I figure if I'm going to button down the configuration of this system I'll need something like this.

    [Listening to: Styx - Renegade]

    Assembly.LoadFrom + FileNotFoundException

    Jonathan gives us a solution to an
    Assembly Loading puzzle. I will eventually need to load my own assemblies, so any hints, workarounds, fixes, best practices: straight to the blog.

    Update: He's posted a follow up here

    Monday, May 17, 2004

    IT Security at Microsoft Overview

    Michael Howard points to an overview of IT Security at Microsoft. If you care about security (rhetorical question) you should be reading his blog.

    Friday, May 14, 2004

    App.config Examples

    Suzanne Cook gives some useful examples of App.config.

    She doesn't post often, but when she does it's a keeper.

    [Listening to: Tripping Daisy - Rise]

    Thursday, May 13, 2004

    Like the new skin?

    Couldn't help myself. Blogger.com has added a ton of new features.

    [Listening to: Adema - Freaking Out]

    Moving from NUnit to MbUnit -- here goes nothing

    With some encouragement from my first ever Blog Comment (thank you Jonathan) I'm trying to convert from NUnit to MbUnit. I figure I'd document as I go.

    Having dropped the latest version of MbUnit onto my VPC I figure I'd load some existing assemblies to see what happens when using the MbUnit GUI against an NUnit assembly.

    First, add an assembly. Hang on... no menus. I had a brain-blip. For a second or two (I hope it was only that long) I couldn't figure out just what to do. Thankfully my well trained right-mouse-button-index-finger jumped in and pulled me out of my haze. Of course, the context menu. Where was I again? [Is it time for my pudding?]

    Oh, yes, adding assemblies. Adding my previously compiled assembly gave me a security exception. I guess this isn't too much of a surprise as I'm developing as a non-admin. In particular it was a security error from Microsoft.ApplicationBlocks.ExceptionManagement trying to access the registry. Cool thing is, this error "went away." Okay so I cheated. I ran the app as an admin, then I ran as my user again.

    Running a second time I get a different error (progress, no?) It's a System.BadImageFormatException. I know this one. Since I'm running the .NET 1.1 binary on a Whidbey/CTP2005/.NET 2.0 machine it tips over. I can deal with that. Just as the following line to the MbUnit.GUI.exe.config
            <supportedRuntime version="v2.0.40301" />

    Okay, third times a charm right. Not quite. The app runs. Adding assemblies appears to be working but nothing happens. Running tests does nothing. Removing assemblies does nothing.

    Let's try recompiling with MbUnit...

    First removing all references to NUnit.Framework; easy enough.
    Add references to MbUnit.Framework.dll. You'll need MbUnit.Core.dll too.
    Replace using NUnit.Framework; with using MbUnit.Framework; (for TestFixtureAttrbite a.k.a [TestFixture]) AND using MbUnit.Core.Framework; (for TestAttribute a.k.a [Test])

    This probably would've been all that's required except that I have some custom NUnit type assert code for things that NUnit missed like AreEqual methods for System.Xml and System.Xml.XPath. So for that there were a bunch of code changes required. I can't help but notice the MbUnit.Core.Framework.Xml namespace. Perchange my custom stuff can go by-by?

    BTW: If you aren't using Lutz Roeders amazing .NET Reflector why don't you? Developing in .NET with it is like a kybrd wtht vwls.

    So far, so good. I have an assembly.

    WooHoo. I'm able to run the tests. A few aren't working, but hey, I changed some code and replace the whole unit testing framework. 2 failures out of 64 tests isn't too bad (I'll look at those later.)

    There's a few hiccups with the GUI (loading multiple assemblies caused some grief) but it mostly worked. And the HTML report is sweeet. Once I get the kinks ironed out I'll post again.

    That's all for now. Got to get some sleep for my day job. Sigh.

    [Listening to: Rob Zombie - Return of the Phantom Stranger]

    Composite Unit Testing with MbUnit

    Jonathan de Halleux uses MBUnit for Composite Unit Testing. I so have to try this.

    I originally saw this in a CodeProject article. It seemed almost useful then (no offence Jonathan) but it didn't click until now. I'll let you know how it goes.

    Beware File.OpenWrite

    I can just see me falling for this. CraigBlog - Beware File.OpenWrite. Courtesy of Craig Andera

    Exclusive read access to MSMQs

    Jeff Key gives tips on
    exclusive read access to an MSMQ queue. This might be useful.

    Wednesday, May 12, 2004

    New version of SnippetCompiler

    Via the Larkware Daily Grind there is a new version of Jeff Key's awesome SnippetCompiler App