Note to self: Another Software Idea

In the same vain as another post, I or someone needs to write a Visual Studio 2005 add-in for managing the Break on Exception feature.  Specifically, be able to create profiles that can easily be switched between during debugging sessions that would enable/disable breaking into the deubber on certain types of exceptions but not other.

As I’m sure anyone who has worked on a large .NET project has experienced, not having this capability built-in is a royal pain in the butt.

Chef and Vista

As I mentioned last night, I made the 1.0.0 build of Chef and started doing some installation testing on Vista.

It’s official – Vista’s UAC is kicking my ass.   It’s during the database setup that I’m having the problem.  Sql Server gets installed OK, it’s for some reason the database restore that times out.

Kinda tired of running the sql express install at this point.

Note to self: software idea

I would like a software product that would allow me to define “profiles” of windows services to be running or stopped.  For instance, there are times when I’m not on my LAN at home and want to code on my laptop.  That entails having my sql server instance up and running.  But I don’t want it running the vast majority of the times hogging resources.

So if I could have this little app and just click a button to start/stop a group of services, that’d be great.

Current Book

I am reading Code Complete, 2nd Edition (great Valentine’s Day gift Ana! ;) and must say that it’s much better and far more interesting than I expected it to be. I thought of it as being one of those books that you just have to read, but would probably be a chore to do so. Boy was I wrong.

If you’re in the business of writing software, you DO have to read this. It isn’t a high-level, software design book. Instead, it’s all about the small things you do and decisions you make at the mundane levels of coding – the naming of methods, size of methods, general formatting, comments, etc.

It’s great to see this stuff written down.  In the time I’ve been coding, I’ve noticed myself continually refining my style and gradually honing in on many of the techniques and suggestions recommended in this book.  Now that I’ve seen it written down, I can have more confidence in my style – that it isn’t just my gut feeling about how the code should be written.

I think that if I were running my own shop, I’d put this on a mandatory reading list for all of my developers.   It would fit in nicely with The Pragmatic Programmer and result in better code by better developers.

Visual Studio on Vista

As mentioned I installed Vista on my new desktop, since I have been running it on my laptop with Visual Studio for a month now without any real problems. Go figure, I ran into an issue that has been bugging me for the past couple days.

The symptoms are as follows:

  • Every time I start VS, it prompts me for which initial environment I’d like to use (C#, C++, etc).
  • If I look at Tools..Options..Import/Export Settings, the settings file path doesn’t include a drive and root directory – it’s just Visual Studio 2005/Settings/CurrentSettings.vssettings.
  • If I go to that Import/Export Settings screen and then try to leave it without changing anything, it blows up regarding the messed up path.
  • Each time I exit and re-enter VS and view that setting, it has appended a new number to the filename. Sure enough, I can see lots of those files being created.

The problem?

It turns out that VS didn’t like the fact that I changed the Location of my Documents folder to point to a network share. Pretty odd behavior though, glad I remembered I made that change.

Vista and Visual Studio 2005

I knew I was taking a slight risk installing Vista on my laptop, where I do quite a bit of my coding.  I’m having a big problem with the Chef solution in Vista – it compiles and runs just fine but in the Visual Studio IDE I cannot open the WinForm Designer for anything but the simple forms.  Scenarios I have that cause the designer to blow up:

  • System.Windows.Forms.Form derived form that references controls that reside in another, referenced assembly
  • UserControl that derives from another custom UserControl that resides in the same assembly, and which can be designed.

I wonder how long this is going to take to get fixed.  I don’t see this issue on their “known issues” list, maybe I should dig around and find out how to submit it.

Strong Naming

As a continuation of my last post, I thought some of you .net developers may be interested in hearing about some of the issues I ran into when strong naming.

Admittedly, this is my first real attempt at using strong naming as it’s intended and therefore I just wasn’t aware of a few things when I was writing the code for Chef. Two days ago I created myself a strong name key (sn -k keyfile.snk) to sign my assemblies with. Due to the obfuscation step I need to do between compile and packaging, I need to delay sign the assemblies.

In an exercise in curiosity I decided to sign the assemblies with the public key half of my keypair and keep the private key “secret”. Which really means just not kept inline with the sourcecode, but rather living in a key container in the machine store on the build box. This process was mostly problem-free, I used the sn.exe utility to: create a keypair; import the keypair into a key container; extract a public key from the key container; tell .NET to allow me to run partially signed assemblies with that public key token (sn -Vr *,) for debugging purposes. It all went well until I went into visual studio and told it to use the public key for signing – it kept telling me that it was password protected and prompting me for the password. I never put a password on it.

So to get around that, I did the first step (creating the keypair) from Visual Studio and gave it a password, then it all worked just fine.

One feature in Chef is the ability to create bookmarks. In my ignorance, I was simply using the BinaryFormatter in .NET and serializing to disk an array of these things for loading later. Little did I realize that all of the version information for the objects is written out – and if the objects live in a strong named assembly and the assembly version changes, it cannot deserialize! There’s supposed to be a way you can get around this, by setting AssemblyFormat on the formatter to Simple but it continued to write the version information. I also tried the route of using a custom Binder during deserialization and that didn’t work either.

As a result, last night I rewrote that code to serialize/deserialize the information myself with XmlWriter and XPathDocument rather than rely on .NET. Version issues gone. That’ll definitely be something I’m not likely to forget anytime soon. I need to rewrite one other small area this weekend for a similar problem, then I can move on. All that’s standing between me and Beta 2 is some thorough testing, a website update, and a file upload. Should all happen this weekend.