Bizarre error message with .NET 4.0 and embedded interops

Recently, while I was working on rearranging some source in our source code repository at work, I ran across an interesting error…

“Predefined type ‘Microsoft.CSharp.RuntimeBinder.Binder’ is not defined or imported”
   – and -
“One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?”

I scratched my head for a little bit and thought, man, that’s quite a bizarre error.  So, without further ado, I whipped out trusty google (actually, I used Bing) and searched away.  My first hit took me to an article on msdn.  My first thought was that I had found a quick solution.  Alas, that was not to be the case.  The following solutions were provided:

To resolve this problem, follow these steps:

  1. Make sure that you do not specify the /nostdlib option from the command line compiler.
  2. Make sure that the project refers to the correct Mscorlib.dll file.
  3. If steps 1 and 2 do not resolve the error, reinstall the .NET Framework SDK.

Woah!!  Hold the phone.  I’m certainly not going to reinstall half of my development tools.  And I certainly wasn’t running into option 1.

 At this point, however, I remembered another stranged error I had encountered just moments before.  During this task, I had also upgraded my projects to .NET 4.0.  Since I had moved file locations, I was forced to remove and re-add the assembly references for the project once more.  In a different project, I had an error indicating that I could not embed an interop assembly.  I thought that was odd, as I hadn’t indicated I wanted to embed it.  Sure enough, though, the default for Visual Studio 2010 is to set the embedded property of the reference to true.

Changes this to false if you get the above error

Remembering this, I looked at the new references I had just added again to the project now in question.  As I had thought, I had added an interop assembly…namely Interop.IWshRuntimeLibrary.dll.  Changing the property to false fixed my issue.  Too bad Microsoft’s article may cause some poor developer to wreak havoc on his development machine for no reason.

Have I mentioned that I really love misleading error messages?

Shift key in Parallels with Remote Desktop

I had an interesting problem that had been driving me nuts.  I am one of the few unbiased developers out there who love all different toolsets.  Because of this, I have a Macbook Pro on which I run Snow Leopard and Windows 7 through Parallels.  It allows me access to a variety of tools all at once.  With .NET and C# being my most favored language at this time, I am constantly in my Windows VM.  In addition, I typically will VPN into work through my Windows VM, leaving my host OS using my local internet connection directly.  On top of that, rather than using my VM directly to do development for work, I tend to remote desktop into my machine at work and do most of my development for work there, leaving my personal PC clean for playing around with all sorts of things.

I noticed recently, however, that I was having a very difficult time typing my password into my RDP connection.  It is a combination of many letters, numbers, and capitalizations.  It dawned on me when typing an email that it was because my Shift key was not working very well.  Sometimes it seemed to work and other times it would not.  I began to get a little suspicious as I only saw this behavior while in the RDP session of my Windows VM.  So, a little googling later, and I came up with what seems to be the solution.

Here the link to the original page.  Basically, there’s an option in the Parallels VM configuration to optimize the keyboard for games (Virtual Machine -> Configure -> Options -> Advanced -> Optimize modifier keys for games) .This seems to have done the trick for me.  If it changes, I will update this posting to let you know.


Really, BP? REALLY!?

While I can understand wanting to carefully control your company’s image after something like the BP oil spill, this is beyond ludicrous.

Update: It looks like BP is taking it on the chin.  At least they have the wherewithall to actually admit it.

SQL Server 2008 upgrade failure due to SQL Express Tools

I just love bogus errors.  I would rather have a vague error, such as “I couldn’t do this!”, or “Critical Error!” rather than specific error messages that are just plain wrong.  In this particular case, I was attempting to upgrade my SQL Server 2005 installation to SQL Server 2008.  More specifically, just the management tools.

In any case, I got a big failure when the installation program decided it couldn’t upgrade me because I had SQL Server Express Tools installed.  It politely informed me that I needed to remove them and try again.  Of course, I had never installed SQL Server Express on this machine at all, and so I started to fume for a moment, thinking of a few choice words I’d have for the errant program that had installed these tools without letting me know.  But, before I got too far down that line of thinking, I thought I would take a stab at checking google.

Low and behold, someone had posted the solution to my problem!  In my case, it wasn’t SQL Prompt, but SQL Search.  Once I uninstalled the miscreant plugin, I was up and running again.  Thankfully, the installation program didn’t make me start all over, but I could hit the back button and run the test over again (Microsoft finally got that right…I cannot count the number of times I’ve failed a validation during an install and had to start the sometimes hour long install over again).

Working with Xcode – I miss Resharper

I must admit, most of the applications I’ve used on my shiny new macbook pro have been quite nice to work with.  I’m still not convinced on some of the nuances that Mac OSX has versus Windows (for example, most applications have a lot more windows on Mac OSX.  Less is more).  One of the glaring things that I’ve noticed is that Xcode is not the most intuitive development tool of this era.  I’ve been a .NET developer for many years now and I’m quite sad to say I’m addicted to Intellisense.  I don’t think I could code effectively without it, and truth be told, frameworks these days are entirely too large to memorize.

So, imagine my surprise when I didn’t see any type of intellisense pop up when I was first experimenting with Xcode.  Sure, I’m new to the tool, but I would think that something as ingrained in the workflow of a developer wouldn’t need special instructions, right?  My first thought (and fear) was there was no intellisense in Xcode.  For a few moments, I fumbled around with different keyboard shortcuts before I abandoned that attempt and went directly to my source of truth, Google.  Sure enough, there is an implementation of intellisense in Xcode.  It just uses the Esc key, not Ctrl+Space or something a little more intuitive.  I usually think the Esc key will exit something for me, not pull up a feature.  But that’s alright, I have intellisense now.  Update: There are a few more hotkeys that can be used with this feature.  Check the Edit menu for the completion list.  Most notably, the Ctrl + . key will auto-complete the next available entry, and you can cycle through them.

I do, however, miss Resharper.  I would love for Jetbrains to come out with a version that works with Objective C in Xcode.  I’d buy a second copy if they did.  I miss the formatting and static analysis that Resharper has.  Fortunately, there are some under the cover hacks to get Xcode to do what I want.  Check here for instructions to have new code generated with the curly brace on a new line.  I know…I know…one true brace and all of that, but I just don’t like it.

A complete software rewrite?

During the time I’ve been in the software industry, I’ve seen quite a few ‘rewrites’ of existing products. Realistically, there are many arguments on both sides.  The most important argument, in my opinion, is the amount of available funding.  In any business, risking all of your funding on an endeavor that may or may not improve your bottom line is always questionable.  The goal of any business, including a software company, is to stay solvent and to make money.  Short term and long term decisions have to be balanced well in order for the business to operate at its best.  Careful consideration needs to be taken in order to determine whether or not a sick product requires careful surgery, or complete replacement.  Most of the time, replacing the product is much much more expensive than carefully improving the existing product.

Here’s an article that talks about one company’s experience at rewriting their existing product.  I have to say that I agree with the author of the blog.  Sometimes you just have to bite the bullet.  For example, if you need your existing product to operate on modern operating systems, you will sometimes need to rewrite the product in new technologies.  The ASP to ASP.NET move, for example, was probably a wise decision given how many developers would likely be moving away from ASP in favor of ASP.NET or some other platform.

Maintenance costs of old technologies tend to grow with time as less and less people are qualified to work with them.  Hiring managers generally have a hard time finding the appropriate talent, wasting months and months of precious time.  When they are finally found, the price tag for the individual is usually very high due to their risk of not moving on to newer technologies (and a broader job market).  At some point, it becomes almost essential to rewrite a product, if only for that reason alone.

Most of the time, rewriting a product due to a bad architecture is probably not the correct approach.  Small evolutionary changes can be made that gradually (and sometimes drastically) improve the product, both from a marketability and user experience perspective.  It makes little sense to take a product that has been grown over a decade and decide to throw it all away.  Joel made a good point with that, not because engineers don’t learn, but more due to the fact that it is near impossible to comprehend the entire scope of something.  Accounting for everything in a rewrite is something that is very hard to do.

I have yet seen a rewrite be completely unsuccessful.  But then, I haven’t seen one live up to its hype either.