After a few months of working flawlessly for "normal" web development (ASP.NET + SQL Server + Virtual Earth etc), I finally ran into some weirdness that I could only trace back to Vista 64, and even then not "definitively".
Basically I was porting a web service that created 1:100,000 scale PDF maps, from ArcGIS Server 9.1 to ArcGIS Server 9.3. Along the way I was refactoring the code, and adding more unit tests. Pretty straight forward really.
I started this work on my notebook, which is running the 32bit version of Vista Ultimate. After a few hours, I had the code worked just fine, but was still looking at the refactoring. For those who've done burly refactoring, you can appreciate that working on a small 13 inch notebook screen is a pain compared to a 3 monitor workstation, so I moved over to it when I was back in the office. Enter the weirdness.
The application itself is pretty simple - given a 100k map sheet name and an email address, create a 1:100,000 scale PDF of the map sheet, drop it in a pickup folder and send a notification email with the url to the file. In code, it's pretty simple:
Of course working with ArcGIS Server means that there is a whole mess of Server Context fun in the mix as well. Moving on...
Quite simply, at step #2 in my pseudo code list above, IFeature.Shape.Envelope was throwning a COMException, saying that a Class was not registered. Uh-oh.
This is the actual exception in all it's obscure glory:
System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))\r\n at ESRI.ArcGIS.Geometry.IGeometry.get_Envelope()\r\n at FHTET.MapSeries.MapRequestProcessor.CreateMapSheet(MapRequest request) in F:\\Web Sites\\FHTET MapSeries\\src\\trunk\\FHTET.MapSeries.Core\\MapRequestProcessor.cs:line 83
Nifty - apparently IEnvelope was not registered. Only ArcMap worked just fine, so it was registered. Kinda. Sorta. WTF?
I had run into some registry silliness with MbUnit and TestDriven.net on Vista 64, and this smelled of something similar. And of course the same code worked just fine on XP and Vista 32. I hacked around at it for a few hours, trying all sorts of stuff, but regardless, no matter how I'd try to get an IEnvelope, I'd get this COMException.
I also posted to the illustrious ArcGIS Server Forums, with zilch in terms of a response. I guess no one else is running Vista 64?
At that time I had the ArcGIS Desktop 9.3 and the Server 9.3 ADF installed on my workstation. On my notebook I also had the Desktop Developer Kit - so I tried installing this on my workstation. Not good. After that, I started getting the same COMInterop Exception on IFeature. Doh! More registry scrambling. ArcMap still played nice, so it looks like the issue is related to the RCW's. Who knows - the bottom line for me was that the same code was still working smoothly on Vista 32 and I have to solve MY problems for MY clients, and not spend time sleuthing out ESRI related problems. Thus, I decided to pack it in and re-pave my workstation back to Vista 32.
The upside of a kickin workstation is that installs happen really fast. In this case I had the OS installed, and the box back on our domain with MSOffice Everything, Visual Studio 2008 and various helpful tools all loaded in less than 2 hours. I've got my ESRI installers on a network share so they should fly, but I have to head out to the airport now, so that will happen on Friday.
I'm Dave and this is my blog. I'm usually writing about .NET Software Development, ArcGIS, or Agile Practices, but other stuff does creep in from time to time. I hope you find something of use, and feel free to contact me if you have any questions. You can also check out my profile on LinkedIn
dojo.DTSAgile.com is our technology preview / demo site. As I and my team cook up cool things we post them here.
ArcDeveloper.net is a site that hosts a set of open source projects related to ArcGIS. This includes Tile Cache for .NET (TC4N) and Feature Server for .NET (FS4N). Come over and check it out!
Assembla is a free service that provides Subversion source control, wikis and work Tracking. The ArcDeveloper project is run from here. It rocks. Check them out today.
Agilistas is a LinkedIn group focused on discussing and promoting Agile practices. Everyone is welcome to join in the conversation as we evolve the process of creating software to make it more enjoyable for all involved.