Microsoft SOAP – Lather, Restart, Repeat

A friend recently asked me to add web service wrappers around some C# .NET code I had written awhile back.  Since Microsoft invented SOAP/XML, it’s not surprising that it’s easy to do in .NET: just create the ASMX file and WebService subclass (with WebService and WebMethod attributes), and .NET handles the rest.  Visual Studio (in my case, VS 2008) even provides templates and wizards to create these for you: nice things like New Web Site – ASP .NET Web Service and Add New Item – Web Service.

I drank the .NET Kool-Aid back when I built this system and constructed with layers of assemblies.  So re-use was fairly straightforward: just add calls to methods (DLL entry points) in the appropriate layer.  Here again, with “Add Reference” and using clauses, Visual Studio makes it very easy.  That is, except for the bugs.

I occasionally got the familiar “type or namespace could not be found” error.  I assumed I had messed up a reference or using clause, or had a problem with the referenced assembly or one of its children.  But every possible cure for these yielded no joy.  Intellisense recognized the references just fine, but the compile/build didn’t.  The solution?  Restart Visual Studio.

This is a recurring bug which seems to move to new areas with each new VS release or fix.  In this case, it seems to be unique to web services referencing .NET assemblies, but it may pop up in other areas.  If I did regular .NET development (like maybe for my day job), I’d keep current on releases and fix levels.  But for this quick exercise, I stuck to the familiar Windoze-land solution: take one restart and call me in the morning.

Share This:
  • Print
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Google Buzz
  • RSS