Friday 15 May 2009

Horrible error running against a 32bit .Net Library from a 64bit application

This post has moved to http://www.scottleckie.com/2009/05/horrible-error-running-against-a-32bit-net-library-from-a-64bit-application/

So, this is my first new dev project on my shiny new Windows 7 64bit machine (having come from a 32bit Vista box). As it happens, I want to use the Microsoft Data Visualization Components, which are only available as a set of 32bit DLLs compiled sometime in 2006.
OK, all good so far – loaded ‘em up, referenced them, threw a TreeMap control on my form, compiled fine and then ran it, and… Bang!
image
Got a message;
Could not load type 'Microsoft.Research.CommunityTechnologies.Treemap.NodeColor' from assembly 'TreemapGenerator, Version=1.0.1.38, Culture=neutral, PublicKeyToken=3f6121a52ebf7c82' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field.
Turns out the problem is that I’m referencing a 32bit component from a 64bit application, and that there is a union of objects on a 32bit boundary, not a 64bit one. Think that’s right, but anyhoo, the cure is obvious in hindsight – my application needs to be compiled as 32bit.
As this is my first foray into development on a 64bit machine I didn’t actually know where to set this! Found it eventually, though; on the Project Properties form, go to the Build tab and set “Platform Target” to “x64”. I’ll need to remember to make a conscious decision in the future whether a new app is supposed to be 32 or 64 bit!
image

Downloaded CHM help file shows “Navigation to the webpage was cancelled”

This page has moved to http://www.scottleckie.com/2009/05/downloaded-chm-help-file-shows-%e2%80%9cnavigation-to-the-webpage-was-cancelled%e2%80%9d/

Huh – that was an odd one. I copied a bunch of controls over to my Windows 7 box and the DLLs work, but the help files are stuffed;
image
It seems this is common problem, fixed by right-clicking the CHM file and clicking on an “Unblock” button which I’ve never seen before!
image
I can’t claim credit for this – found it at Rob Chandler’s blog here. Weird sense of priorities, huh? OK to copy and run any old DLL that you found lying in the bin, but a helpfile? Woooohhhh… no… that’s much more dangerous!

Thursday 14 May 2009

Microsoft Data Visualization Components on Windows 7

this post has moved to http://www.scottleckie.com/2009/05/microsoft-data-visualization-components-on-windows-7/

I’ve been playing around with the Data Visualization Components recently (looking to incorporate the TreeMap control with a SequioaView-a-like disk space analyser) but ran into problems getting the toolkit installed on Windows 7 RC1. Running the setup from the official page at http://research.microsoft.com/en-us/downloads/dda33e92-f0e8-4961-baaa-98160a006c27/default.aspx gets stuck looking for .Net Framework 1.1.4322;
image
Of course, being Windows 7, .Net 3.5 is already installed which should include .Net 1.1 but it looks like the Components installer is hopelessly confused. I couldn’t get the installer to believe we had something better than 1.1 already installed and I didn’t want to try and hack .Net 1.1 on top of Windows 7.
So, all I really needed were the “bunch of files” that come in the Component setup so I installed the package on an XP machine and copied them across to a folder on Windows 7, then referenced the DLL by hand.
I doubt there’s any .Net developers out there, running the RC of Windows 7, who doesn’t have a spare XP machine lying around too(!) but, just in case there is, I’ve placed the Zip here for your convenience. The licence states that it’s OK to distribute for non-commercial use and doesn’t say it needs to be in the original MSI format, so I don’t see a legal problem with this.