Jastro

MapControlClass and License. Fails with COM Exception 80040112 (Editor License)

Discussion created by Jastro on Nov 6, 2012
Hi folks,

I wanted to test my Map application with several maps, just using ArcEditor License (Concurrent Use) without any Engine (No Runtime or Developer Kit running/licensed). In my opinion this should work.

I am using AOInitialize with Editor License in App.xaml to init the license. My main map is running properly, but I don't use MapControlClass in this case. MapControlClass is used within a method to copy layers out of my main map into a new mxd file.

Heres the code:


IMapDocument pIMapDoc = null;
IMapControl2 pIMapCtl = null;
try{ 
     pIMapCtl = new MapControlClass();
     pIMapCtl.Map = _mapControl.Map;

     IMxdContents pIMxd = (IMxdContents)pIMapCtl;
     pIMapDoc = new MapDocumentClass();
     pIMapDoc.New(pathToMapDocument.FullName);
     pIMapDoc.ReplaceContents(pIMxd); 
     pIMapDoc.Save(false, false);
}
 finally{ 
      if (pIMapDoc != null) 
           Marshal.ReleaseComObject(pIMapDoc);
      if (pIMapCtl != null)
           Marshal.ReleaseComObject(pIMapCtl);
}


Code crashes in line:
pIMapCtl = new MapControlClass();


Error Code is:
HRESULT: 0x80040112


I found out that everything works fine until I do the following during Initialisation of the new MapWindow:
((System.ComponentModel.ISupportInitialize)(this.axMapControl1)).EndInit(); 


Does anybody had this problem too and knows how to solve it? I am sure that my License is initialised and on ArcEditor.

Thanks in advance!

Jan

Outcomes