Wednesday, September 03, 2008
Posted on Wednesday, September 03, 2008 10:47:30 AM (Mountain Daylight Time, UTC-06:00)  Comments [5] | 
Categories: ArcGIS Devt | ArcGIS Server

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".

Background

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:

  1. Using a query filter to locate the 100k tile feature
  2. Zoom the map to the extent of said feature
  3. Draw the feature on an inset map (separate data frame)
  4. Swap out the content of whole bunch of Text Elements in the map surround
  5. Write out the PDF
  6. Swap the Text elements back to their original values (so we can re-use the SOC)

Of course working with ArcGIS Server means that there is a whole mess of Server Context fun in the mix as well. Moving on...

The Problem

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?

One Last Try

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.

Wednesday, September 03, 2008 2:03:26 PM (Mountain Daylight Time, UTC-06:00)
Thanks for posting this. I've got a new 64 bit machine with vista on it and will soon be installing ArcGIS, so this is good to know. I don't get the impression many others are running ArcGIS on 64bit. Looks like Sebastian is http://www.palladiumconsulting.com/blog/sebastian/2008/08/installing-arcims-93-on-vista-or-vista.html but not aware of others.

Are you saying you will install Vista32 on 64bit hardware? Is this allowed?

Just curious, did you try IFeature.Extent instead of IGeometry.Envelope? I also wonder if the IEnvelopeGEN vs. IEnvelope might be a factor in this.
Wednesday, September 03, 2008 8:18:57 PM (Mountain Daylight Time, UTC-06:00)
@Kirk:
Virtually all hardware made today -- all mainstream AMD and Intel CPUs -- are 64-bit hardware. Since you can run 32-bit OSes (WinXP and Vista32) on them, this means that yes, it is "allowed" to run a 32-bit OS on 64-bit hardware.

@Dave:
I can imagine somehow that your code was on one side of the WOW64 subsystem and the COM object you were after was somehow on the other side of some virtualization barrier. Doesn't help you much, but I can understand that such errors could crop up.

At the end of the day, in 2 years everyone will be running 64-bit everything. I've lived (and programmed) through the 8-bit to 16-bit transition, the 16-bit to 32-bit, and now the 32-bit to 64-bit. In a very short time no one will care about 32-bit OSes, any more than anyone cared about 16-bit Windows 3.1 once Windows NT4 and Windows 95 came out with real 32-bit applications.
Wednesday, September 03, 2008 8:53:25 PM (Mountain Daylight Time, UTC-06:00)
@Kirk,

I've just started running Vista64 also but I do all my development in virtual PCs with VPC2008. All my v9.3 development so far has been on a VPC of Windows XP. It's nice having a clean system for each project, but it eats up the disk space.


David
Tuesday, September 09, 2008 10:01:16 AM (Mountain Daylight Time, UTC-06:00)
@Chris -
Thanks for the feedback Chris. Guess I'll probably end up replacing Vista64 with Vista32 on my machine too.

Since ArcObjects is limited to 32bit mode, I guess this means I'm stuck with the 4Gig memory barrier even if I compile on a 64 bit machine (?)

@David - I've let my MSDN subscription lapse, so I'd need to purchase an OS license for each virtual machine (right?) Are you getting many false positive bugs on VPC? (Bugs that show up on vm but not on physical machine?)


Tuesday, September 09, 2008 10:52:55 AM (Mountain Daylight Time, UTC-06:00)
Thanks Dave for the tip. I just got a smoking workstation too and have 64-bit on this as well. Guess I'll stay away from the ArcGIS on this machine until ESRI gets a 64-bit version out.
Comments are closed.