(The solution to my problem is detailed below)
The project that I’ve spend most of the last eighteen months working on uses Microsoft’s Windows Communications Framework (WCF) to move massive amounts of data around. This is a relatively new technology and it seems that most people aren’t using it to the same extent that our project requires.
Whenever we’ve come across a problem, we’ve usually been on our own in terms of finding a solution. Our one call to the Microsoft paid support center resulted in our teaching their support techs a cool new troubleshooting technique (I’ve noticed that until you get to the very top tier in the MS support system, the people you deal with are not much more than well coached super-users; the actual developers of whatever tool you’re calling about have moved on to other projects).
Anyway, today, I ran into a recurring problem that we’ve had since we started using this WCF technology. Whenever I tried to update the WCF service reference, I kept getting the dreaded
custom tool error failed to generate code
error message. In the past we’ve had success with several operations to get past this problem:
- Re-Configure the service reference to Re-Use/ NOT Re-Use typed in referenced assemblies
- Re-Use specific types in the referenced assemblies
- Delete/Re-Add the service Reference
The last option almost always works since you’re basically “nuking” the references altogether, only to re-create them, often with no difference in the target service to which your making a reference in the first place!
Today, not even that last option was working. Nothing that I tried seem to work. I even went into Source Control and did a fresh “GET” from the last good source that was checked in.
Still nothing. Then I saw what I should have seen the very first time this happened over a year ago: There were warnings pertinent to this error.
Normally, when we get error messages, fixing the error results in builds with no warnings (.NET compilation is a very forgiving process, resulting in a very rapid development cycle).
But today we were getting warnings. The problem is that the warnings are displayed in a different tab than the error messages. So it never occurred to me to look at the warnings (I still can’t recall why I happened to look there today).
Anyway, one warning (which should have been an error, IMHO) indicated that a data type had changed in the referenced assembly and that this change was resulting in the error message shown above.
With this extra knowledge in hand I updated the referenced service on our web server (since it was out of date, hence the data type mis-match, it needed to be updated as well). I selected “Update Service Reference” in the Solution Explorer, and viola, the references updated properly, my project built properly and I was able to get on with testing.
But I managed to waste a good couple of hours before I looked at the Warnings tab.
So moral of the story, “some errors are caused by warnings.” Or something like that.