Select to view content in your preferred language

TypeInitializationException with ArcGIS Mobile 9.3.1

841
4
10-21-2010 04:46 AM
MaximilianGlas
Esri Contributor
We have a project for a customer using ArcGIS Mobile 9.3.1 running on a windows desktop toughbook.
For better knowing and controlling which version of ArcGIS Mobile is used for the project we do not install the arcgis mobile runtime but delivering following files with our software:
ESRI.ArcGIS.Mobile.dll (9.3.1.3000, 484kb) -> included as .net library in our project
ESRIMobileCore.dll (9.3.1.3000, 296kb) -> just copied to same directory like ESRI.ArcGIS.Mobile.dll
ESRIMobileGPS.dll (9.3.1.3000, 241kb) -> just copied to same directory like ESRI.ArcGIS.Mobile.dll
ESRIMobilePE.dll (9.3.0.1738, 552kb) -> just copied to same directory like ESRI.ArcGIS.Mobile.dll
ESRIMobileSdc.dll (9.3.0.1339, 1400kb) -> just copied to same directory like ESRI.ArcGIS.Mobile.dll

So, for long time it was no problem to start our program like that.
But sometimes we get an TypeInitializationException after compiling new and running program.
The error appears in the MainForm Designer File on initialising the form:
  private void InitializeComponent()
  {
   this.components = new System.ComponentModel.Container();
   ESRI.ArcGIS.Mobile.MetricUnitLabels metricUnitLabels1 = new ESRI.ArcGIS.Mobile.MetricUnitLabels();
   System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMap));
   this.p_Map = new ESRI.ArcGIS.Mobile.Map();
   this.sketchGraphicLayer = new ESRI.ArcGIS.Mobile.Sketch.SketchGraphicLayer();
   this.p_ScaleBar = new ESRI.ArcGIS.Mobile.ScaleBar(this.components);   //<--- Error
   this.p_ToolStrip = new System.Windows.Forms.ToolStrip();
   ...
                }


This is part of designer, we did not change anything.

The full exception message is:
System.TypeInitializationException: Der Typeninitialisierer für "ESRI.ArcGIS.Mobile.SpatialReferences.ProjectionCoreApi" hat eine Aussnahme verursacht. ---> System.InvalidOperationException: Missing ArcGIS registry key.
  bei ESRI.ArcGIS.Mobile.Native.WindowsApi.LoadCore(String dllName)
  --- Ende der internen Ausnahmestapelüberwachung ---
ESRI.ArcGIS.Mobile.SpatialReferences.ProjectionCoreApi.CreatUnit(String unitName, Double factor)
  bei ESRI.ArcGIS.Mobile.SpatialReferences.Unit..ctor(UnitTypes type)
  bei ESRI.ArcGIS.Mobile.SpatialReferences.Unit.UnitCollection..ctor()
  bei ESRI.ArcGIS.Mobile.SpatialReferences.Unit.get_Units()
  bei ESRI.ArcGIS.Mobile.ScaleBar..ctor()
  bei ESRI.ArcGIS.Mobile.ScaleBar..ctor(IContainer container)
  bei MyProject.InitializeComponent()
0 Kudos
4 Replies
MaximilianGlas
Esri Contributor
I got a knew developer machine, now based on Windows7 64-bit.
And now I really have a problem. I am not able any longer to start our project because this error is appearing all the time.
All ArcGIS Mobile assemblies are side by side with my project assemblies. This is ok for ESRI.ArcGIS.Mobile.dll, but it seems not to be for the others.

I even tried to install the ArcGIS Mobile 9.3.1 Runtime Installer (32 bit). But as it is a 32-bit Installer it does not fit for my OS: I still get the error message.

What am I doing wrong?
What are my options? What do I have to do making my project runnable again?
0 Kudos
AkhilParujanwala
Regular Contributor
Delete the scalebar, then run your application without the scalebar.

I sometimes see this being a problem on the sample code given by ESRI. I know you need the scalebar for certain things but by removing for now, making sure everything else works and then figure out how to add the scalebar again.

I hope this helps.
0 Kudos
MaximilianGlas
Esri Contributor
I knew it is the scale bar. But it is no solution for me, to delete it. The customer would not say: "Hey, no problem, delete everything you need, mainly the system runs ..."

But I found out a solution working for me: in the project settings, change the platform target to x86. That's it.
0 Kudos
AkhilParujanwala
Regular Contributor
Heh, yah I know what you mean, thanks for the solution, I didn't think it would be an X86 problem. Good job!
0 Kudos