SEHException when creating new MapClass

Discussion created by itaibh on Jan 10, 2012
Latest reply on Jan 10, 2012 by sshetty
I'm trying to create a new IMap using the following code (C#) on ArcGIS 9.3.1:
IMap map = new MapClass();

But I get an SEHException on that line.
I have a winforms form running, but no map control. I loaded the licence manually using this code:
ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ESRIMapControl));
ESRI.ArcGIS.Controls.AxLicenseControl axLicense = new ESRI.ArcGIS.Controls.AxLicenseControl();
axLicense.Enabled = true;
axLicense.Location = new System.Drawing.Point(113, 177);
axLicense.Name = "axLicenseControl1";
axLicense.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axLicenseControl1.OcxState")));
axLicense.Size = new System.Drawing.Size(32, 32);
axLicense.TabIndex = 1;

What am I missing?