Hello
In the past, I developped a MapWinGIS program using C# under 32 bit. I use “axMap…”. It works perfectly.
Now I am using 64 bit (Visual Studio 2022 & MapWinGIS 5.3.0.0). I succeed to create the rebuild solution without generating error.
But when I run my program, now I get this error and I absolutely do not know how to solve it:
System.Windows.Forms.AxHost.InvalidActiveXStateException: ‘Une exception de type ‘System.Windows.Forms.AxHost+InvalidActiveXStateException’ a été levée.’
The line code n°133 where the error occurs is : axMap1.LockWindow(tkLockMode.lmLock);
It is within a procedure to “AddALayer”
Here are the details:
System.Windows.Forms.AxHost.InvalidActiveXStateException
HResult=0x80131500
Message=Une exception de type ‘System.Windows.Forms.AxHost+InvalidActiveXStateException’ a été levée.
Source=AxInterop.MapWinGIS
StackTrace:
at AxMapWinGIS.AxMap.LockWindow(tkLockMode lockMode)
at MyLib_SIG.Layer_AddOneFromPath(AxMap axMap1, ListView listLayer, String myFilePath, Boolean PathRel, Boolean Exit_OK, Boolean Exit_Msg) in C:\Users\cdela\Inexis\001 Logiciel\05 CSharp\04 MyLibrary\MyLibrary\MyLib_SIG.cs:line 133
Hello
Nobody has a clue to solve this problem ?
I guess that I am not the only to have trouble while passing from 32 to 64 bits.
Thank you in advance for your help
BEst regards
I’m not sure if you mentioned specifically, but are you using the 64-bit version of MapWinGIS? i.e. Have you specifically registered the 64-bit OCX?
Also, I’m not sure why your call stack seems to go from your method (Layer_AddOneFromPath) straight into the LockWindow call (without passing through the AddLayer method). Perhaps you could post that section of your code to better understand the context?
Hello Jerry
I understand.
Here is a printscreen of «Form1.cs(Design)»: I hope that it can help you to understand the problem. Let me know if you need other information.
Could not load type ‘MapWinGIS.tkShapeDrawingMethod’ from assembly ‘Interop.MapWinGIS, Version=5.3.0.0, Culture=neutral, PublicKeyToken=null’.
|||Instances of this error (1)
Call Stack
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetProperties(Type type)
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetProperties()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.Windows.Forms.Design.ControlDesigner.Initialize(IComponent component)
at System.Windows.Forms.Design.AxHostDesigner.Initialize(IComponent component)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)|
| — | — |
|||
ERROR n°2:
The variable ‘axMap1’ is either undeclared or was never assigned. Go to code
|||Instances of this error (1)
OPAM Form1.Designer.cs Line:497 Column:1 Hide Call Stack
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)|
| — | — |
Sorry: I add the code in the previous message. As you can see, the program says that AxMap1 is not declared. I do not know how to solve this. I didn’t have this problem previously while I was running with 32 bits