January 2009 Entries

I've discovered what was causing problems with TestDriven.Net and it isn't ReSharper.  I had recently refactored my test fixtures and now I have a few that make use of generics BaseTest<T>.  I had run into a problem with TD.Net before regarding generics and had to rearrange my classes (I had two classes in one file) to get it to work.  I don't remember the details and I am still having problems getting it to work now.

Regardless, R# is off the hook.  And as an added bonus, R# doesn't appear to have the same problems with generics in test fixtures.

By the way, I am running version 2.13.2184 or TestDriven.Net... Either it is time to upgrade or simply use R# instead.

On to Day 3...

So day two brought more items of interest.

Unit Testing still problematic

Apparently, ReSharper installs with version 2.2.8 of NUnit.  I am using 2.4.8 which includes syntax helpers.  A bunch of my tests were failing with multiple TypeLoadExceptions. 

To resolve the issue, I ran the tests in debug mode and took a look at where the nunit.framework library was being loaded from.  I found that it was being loaded from C:\Program Files\JetBrains\ReSharper\v4.1\Bin.  Once I determined that I was dealing with a bad version, I just copied the 2.4.8 version there and now all of the tests are running without error.

I turns out that ReSharper is not the culprit here.  See this post for more details.
I tried repairing TestDriven.Net and it still is not running correctly.  Puzzling, as it appears that no one else has encountered this problem.

Automatic Code Completion

I'm going to have to get used to ReSharper completing parenthesis and brackets for me.  I am so quick to add my own parenthesis to methods I end up with two sets because R# added them for me already (e.g.  calling MyMethod(()) ).  We will have to see if I can unlearn years completing them myself.

Trial v. Full Version

I can't help but wonder if the full version would have been absent of my unit testing issues.  Also, it's odd that the nightly download page seems to indicate that build 933 is "not tested" which is the version that downloads for purposes of evaluation.  Is this the same as the purchased version?  Hmm.

More fun tomorrow.

I finally installed ReSharper yesterday to try it out.  I've been dragging my heals because I didn't want to have to learn a bunch of new commands and pay for that right (I'm cheap, I know).

Here are a few things I noticed immediately.  Keep in mind that these are first impressions, and they are sure to change over the next couple of weeks.

I turns out that ReSharper is not the culprit here.  See this post for more details.
TestDriven.Net broken after ReSharper install.

Any time I attempt to "Run Test(s)" now I get a "Could not load file or assembly 'nunit.framework...".  I haven't tried reinstalling TestDriven.Net yet.  I was going to wait until after I've evaluated R#.

Of course, R# has its own unit testing module, which is pretty nice.  You can create test sessions and pick and choose which tests in the sessions to run.  You can also debug.  TestDriven has all those things too and more.  In particular, NCover integration, a considerable loss. 

My key board shortcuts were all changed.

I am a firm believer that the more you use the mouse, the less productive you will be.  I have grown accustomed to using various commands withing Visual Studio to navigate quickly (e.g.  Ctrl W, S for opening Solution Explorer, Ctrl W, E for the error window, etc.).  I was given an option at R# installation for which keyboard scheme I wanted.  Although I chose the Visual Studio option, many of my shortcuts were overridden.  Apparently, Ctrl W now selects a block of code.  Needless to say, when I quickly entered Ctrl W, O to see my output window, I was surprised to see an entire method replaced with "o".

I use a lot of keyboard shortcuts with barely a second thought.  It will take some time to retrain myself.  I'm already not pleased that my various window commands (View Output, Errors, Solution Explorer) are not consistent.  It looks like I will have to do some customization.  Ugh.

Bogus "Ambiguous Reference" error.

R# enhances the IDE in a similar way as VS2008 SP1.  It adds design time "compilation" errors and warnings.  It appears to be much more robust that SP1, but I ran into one major problem.  In my ASP.Net web site application, I have a couple of base pages in the App_Code folder.  Most of my pages are subclasses of these base pages.  R# couldn't handle this inheritance without thinking that there were two instances of my base page.  Thus, it reported and "Ambiguous Reference" error.  This wouldn't be so bad if the rest of the page weren't effectively broken as well.  Because it could not resolve the base page, it could not resolve anything inherited from the base page.  This made it very diffiicult to work on the code-behinds because intellisense was broken.

I was able to resolve the problem by installing a nightly build (yikes).  The evaluation version of R# was build 933.  Reading through the log, I discovered that build 934 included a fix for my problem in particular.  After installing the build, it seems to me that R# (and Visual Studio) is a bit slower than before.

Cool Tools

The first "Wow!" I encountered with R# was the fact that it was able to identify a class that was missing both the assembly reference and the using clause.  In one step, I was able to add both.  Way cool!

Another nice feature is the navigation from one warning/error to another and applying the suggested fixes (Alt PgDn to navigate, Alt Enter to look at the suggestion, Alt Enter again to apply the suggestion).  It didn't take me very long to quickly run through all of the warnings in a file.

I haven't really gotten into the refactoring yet.  My code is already very heavily refactored.  I've used a few different refactoring tools.  Of late, I have been using CodeRush Xpress to handle my refactoring.  I'm sure to make good use of R# refactorings but I haven't yet.

Code Formatting

I suppose I would file this under another annoyance.  I had gotten all of my VS2008 formatting settings just the way I liked them.  After installing R#, they all got changed.  R# offers more options, but, for my needs, nothing significant.  In fact, there are a couple of indenting issues I am dealing with and I'm not sure how to resolve them.

Overall, my first impression is that R# will be more than worth a little headache over configuration and relearning key commands.  I look forward to spending more time with it.  The ultimate goal is for me to forget that R# is even there.  We shall see.

I attended the Houston TechFest today, and am now finding it difficult to sleep with all of the new knowledge and relationships filling my mind.  I finally decided to get out of bed and put some of my thoughts in writing.

The Fest was great.  There are a few good reasons to attend an event like this.  It's free.  You get to meet new people with common interests.  Employment opportunities are there if you are looking for them.  You almost certainly learn something (if not many things).  There are lot's of prizes (e.g. tons of books, 22'' flat screens, 1 terrabyte external harddrive, and many others).  Did I mention it's free?

There are a few things specifically I got out of the event that I would like to touch on.

Public speaking takes courage.

Some speakers were okay, some were really good.  When I consider what makes a really good speaker, it's not primarily delivery.  Delivery is important, but, what I think is more critical is mastery of what's being presented.  Nothing is worse than someone presenting theories.  A good speaker will have meaningful examples.  A better speaker can provide examples based on questions from the audience that go beyond the slides.  Regardless, it takes courage to stand up in front of a bunch of geeks who collectively know more than you can imagine.  All of the speakers should be commended for their efforts.

However, I feel confident throwing a couple of names in the "really good speaker" category.  (I hope they'll agree that truly great presenters are rare.)

Dan Sline did a really nice presentation on Oracle SQL Tricks and Traps.  He did a great job engaging the audience.  He even put up with my heckling.  Dan didn't miss a beat and the timing of his presentation was perfect.  I thoroughly enjoyed his presentation.

I attended a couple of John Teague's presentations, the first on Unobtrusive Javascript (UJS) and jQuery, the second on Design Principles.  I was already very familiar with SOLID and have seen Uncle Bob present it first hand.  It's always nice to get a reminder of the things we should hold ourselves responsible for as developers.  Although John didn't get to show off all of his UJS demos, he took the time to answer a ton of questions (perhaps a few too many from me).  But the point really is to get people moving in the right direction when they are learning new technologies.  John understands this and it showed in both of his presentations.

It's hard to beat free. 

Granted, most of the presentations really only scratch the surface.  If you want to learn ASP.Net from the bottom, up, then the TechFest is not for you.  It's really geared toward supplementing what you already know and giving you some insight into things you want to learn more about but don't know where to start.  That coupled with the Internet can take you leaps and bounds beyond where you are now.

Earlier in my career I didn't even consider "training".  I mean, my college degree should be good enough.  Right?  Clearly, I've learned my lesson (perhaps the hard way).  I was really encouraged by all of the yound faces at TechFest.  In fact, I met someone who has only been "doing software" for a year.  Kudos to him for realizing that "continuous improvement" starts with yourself.  And, what better place to improve yourself than surrounded by a wealth of knowledge in your field of study.  We are all students (whether you admit it or not), and in this case, on a full-ride scholarship.

Relationships are everything.

Even if you aren't in the market for a new job, networking is your friend.  What if your company is expanding?  (Perhaps not likely at the moment, but hey... we are preparing for the future, not just tomorrow.)  Building networks will help you find a job as well as find good people to fill an open position.  It's never too early to form relationships.  Any gathering of techies is a great opportunity.

There's another good reason to maintain good relationships.  We all have different experiences.  My experiences take me one direction, while yours another.  Wouldn't we benefit from sharing our experiences?  Meeting like-minded individuals at a tech conference helps to grow our knowledge, making us better at what we do.  This will make our bosses happy and anyone with a vested interest in our careers.

Well, this is gone on a little longer that I expected.  Perhaps now I can get some sleep.  I hope other attendees enjoyed the TechFest as much as I did.  If you were there, leave a comment and tell me what you thought, good and bad.  I'm always interested in alternate points of view.

I ran into the same old "cannot serialize value myType of type myType" issue the other day and knew immediately that I should check that my classes were marked with the [Serializable] attribute.  Well, I checked and all of the classes had the attribute as required.  So I spent an hour our so searching the web for other reasons why we might get this error.  I found nothing.

So I pinged a buddy of mine and I walked him through the issue.  He said, "It's gotta be one of your classes missing the Serializable attribute.  Did you try writing a test to the serialization?"  For some reason I was avoiding writing this test, but I broke down and did it.

This is what I found.  You must be careful what classes you use to implement IEnumerable<T>.  List<T> will serialize okay, but there are others that will not.  In particular, my problem was with Enumerable<SelectIterator>.  It isn't marked serializable.  Where does this SelectIterator come from?  The Select extension method:

ids.Split( ',' ).Select( id => new Deal { Id = int.Parse( id ) } )

Of course there was a simple fix.

ids.Split( ',' ).Select( id => new Deal { Id = int.Parse( id ) } ).ToList()

The good news is now I have a test so if I forget why the ToList is there and remove it, my test will fail.  The next time I get an error, I will do the right thing... write a test to reproduce it.

A week ago I said I was going to start working on an article about PageMethods.  Alas, I haven't even begun.  Perhaps my resolution should be not to commit to anything extra until all that other stuff goes away.

All kidding aside, what is that "other stuff" anyway?  For me. it's my family; a wonderful wife and two adorable little girls.  It's volunteer time at church.  It's trying to stay in decent shape.  It's getting paid enough with enough time to spare that I can keep my priorities straight.  Oh, and after all of that I might consider sacrificing some sleep to blog here and there.

Jan 17 will mark my one-year anniversary of joining the ranks of bloggers.  I can only hope that I am adding something of reasonable value and not using up bandwidth with pointless text.  I've had my ups and downs.  In March, I blogged 11 times and posted an article.  In September I blogged once (just to prove I was still around).

If you've read much of my blog, you can probably tell I enjoy my work.  I also enjoy sharing my successes (and occasionally my defeats).  I doubt I will be as active in 2009.  I've got a lot of projects on the horizon at work.  And, being part of a company of five means a lot of that will be coming my way.

Ah, finally, I get to the point.  As much as I would like to contribute to the community by posting an article or two.  I cannot honestly expect to follow through.  There are many variations of the following statement, I just hope to remember it before I declare my next side project.
"Want To Make God Laugh? Tell Him Your Plans"

Until next time (God knows when).

After seeing a couple of other posts about resolutions, I couldn't resist.  The funny thing is, I got this on the second attempt.

My Top Priority For 2009

I've had a few comments to my PageMethods blog from about a month ago.  They were all along the lines of "not enough code."  I wasn't really intending to provide a detailed account of my experience, but to exclaim how cool PageMethods are (at least for my scenario).

Well, I am hoping to put some time aside over the next week or two to write a brief article on the subject.  I'll be sure to include all of the code and hope to go through each step of the relatively short process.

By the way, if anyone has any ideas on the domain for this little project please leave a comment.  I'm planning to write something new and unrelated to my work.  So all ideas are welcomed and appreciated.