If you've used the VSeWSS to create a SharePoint solution and deploy it to your development server, then you probably know about the infamous "Object Reference Not Set" bug in it that has had many a hearty developer run back to the comforting arms of WspBuilder. Of course, this issue was not fixed in the CTP version of the VSeWSS v1.1 released in August.
I wait with bated breath for the day (real soon now?) when the final release of 1.1 comes out. However, I simply couldn't wait to get around this problem. Unfortunately, Paul's EXE did not work for me, becaue it refused to connect to the instance of SQL Server that my content databases are stored on.
So, I wrote my own, independently. I'm glad to say that some neat innovations came out of it. Firstly, mine takes a URL instead of a connection string. You can get the connection string from SPSite.ContentDatabase.ConnectionString instead. Second, I learned that the reason for this error is generally always that an attempt to read SPFeature.Definition returns null if there is no feature.xml file in the FEATURES folder with the required matching GUID.
Sadly, I could not create a solution MS would suppport, because trying to call SPFeature.Remove() also causes the error. I suppose you could create a feature.xml file first, and then try this, but I have no idea if that would even work without resetting the application pool and re-retreiving the SPSIte/SPWeb objects or what-have-you.
Knowing this, it's hard for me to imagine that this is going to just stop being an issue when the new VSeWSS comes out. THere are just too many other ways you can accidentally orphan a feature in SharePoint. I suspect we'll be hearing from this one for a long time.
So, without further adieu, here's the source code/ Enjoy!