Dotnet apps not porting to KMotion 5.3.1 libs
Posted: Thu Dec 07, 2023 4:53 pm
I've attempted an upgrade of my dotnet application from KMotion 4.34 libraries to 5.3.1, but am experiencing some issues.
The current version of my app runs normally with KMotion 4.34 libraries and firmware.
Issue #1: The KMotion.exe that is packaged with 5.3.1 cannot update the firmware on my KFlop to the 5.3.1 firmware. After "Yes"-ing the usual "Error Status Record Size mismatch" dialogs during the firmware update process and selecting the New Version/5.3.1 firmware file, downloading begins. After a few seconds, two dialogs appear (KMotion No Response) and (Unable to connect to KMotion Server). I can only update the firmware of the 4.34 KFlop if I use the 4.34 KMotion with the 5.3.1 Firmware file. If I do this, the firmware downloads successfully.
Issue #2: Armed with the 5.3.1 updated KFlop, I then update my dotnet apps as usualy. This process involves copying the following KMotion files from the KMotion Debug|Release folder:
KMotionDLL.dll
KMotion_dotNet.dll
KMotion_dotNet_Interop.dll
GCodeInterpreter.dll
KMotionServer.exe
TCC67.exe
emc.var
...into the debug|release folder of my dotnet applicaton.
I then Copy the folder DSP_KFLOP and it's contents from C:\KMotion<Version> into my Debug1|Release1 folders.
This process has worked through KMotion 4.34. But with 5.3.1, my code compiles under Visual Studio.Net 2022 using the dotnet framework 4.8 but fails to run, presenting an error during initialization of a KM_Controller with this statement:
CODE LINE 12: Public WithEvents ThisController As New KM_Controller
KMotion_dotNet.DMException
HResult=0x80131500
Message=Dll Not Found Exception thrown : Caller - [KMotion_dotNet.KM_Controller] :: Member - [KM_Controller]
Source=KMotion_dotNet
StackTrace:
at KMotion_dotNet.KM_Controller..ctor(Boolean DoNotObtainConsoleMessages)
at MillDroid.MainForm_Class..ctor() in Z:\CodeArchive\VB.Net_2023\MillDroid\MillDroid_7.0.2479\Form Classes\MainForm_Class.vb:line 12
The KMotion_dotNet dll is definitely present and updated to the KMotion 5.3.1 version, and is referenced in the project as it always has been. KMotion_dotNet_Interop.dll is also present in the app's executable folder.
This is a new Windows 11 Pro machine, with the Memory Protection disabled to allow the drivers to work, and a fresh install of Visual Studio 2022. I am assuming that previous versions of Visual Studio 2019 are no longer required, nor are their older debug libraries with the new KMotion dotnet libraries.
Because I use the debug versions, I also have installed the "Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.38.33130" for debugging.
I've reviewed the release notes since 4.34 but can't find anything that seems like it would be a change that could cause this.
Do you have any suggestions for how to proceed?
The current version of my app runs normally with KMotion 4.34 libraries and firmware.
Issue #1: The KMotion.exe that is packaged with 5.3.1 cannot update the firmware on my KFlop to the 5.3.1 firmware. After "Yes"-ing the usual "Error Status Record Size mismatch" dialogs during the firmware update process and selecting the New Version/5.3.1 firmware file, downloading begins. After a few seconds, two dialogs appear (KMotion No Response) and (Unable to connect to KMotion Server). I can only update the firmware of the 4.34 KFlop if I use the 4.34 KMotion with the 5.3.1 Firmware file. If I do this, the firmware downloads successfully.
Issue #2: Armed with the 5.3.1 updated KFlop, I then update my dotnet apps as usualy. This process involves copying the following KMotion files from the KMotion Debug|Release folder:
KMotionDLL.dll
KMotion_dotNet.dll
KMotion_dotNet_Interop.dll
GCodeInterpreter.dll
KMotionServer.exe
TCC67.exe
emc.var
...into the debug|release folder of my dotnet applicaton.
I then Copy the folder DSP_KFLOP and it's contents from C:\KMotion<Version> into my Debug1|Release1 folders.
This process has worked through KMotion 4.34. But with 5.3.1, my code compiles under Visual Studio.Net 2022 using the dotnet framework 4.8 but fails to run, presenting an error during initialization of a KM_Controller with this statement:
CODE LINE 12: Public WithEvents ThisController As New KM_Controller
KMotion_dotNet.DMException
HResult=0x80131500
Message=Dll Not Found Exception thrown : Caller - [KMotion_dotNet.KM_Controller] :: Member - [KM_Controller]
Source=KMotion_dotNet
StackTrace:
at KMotion_dotNet.KM_Controller..ctor(Boolean DoNotObtainConsoleMessages)
at MillDroid.MainForm_Class..ctor() in Z:\CodeArchive\VB.Net_2023\MillDroid\MillDroid_7.0.2479\Form Classes\MainForm_Class.vb:line 12
The KMotion_dotNet dll is definitely present and updated to the KMotion 5.3.1 version, and is referenced in the project as it always has been. KMotion_dotNet_Interop.dll is also present in the app's executable folder.
This is a new Windows 11 Pro machine, with the Memory Protection disabled to allow the drivers to work, and a fresh install of Visual Studio 2022. I am assuming that previous versions of Visual Studio 2019 are no longer required, nor are their older debug libraries with the new KMotion dotnet libraries.
Because I use the debug versions, I also have installed the "Microsoft Visual C++ 2015-2022 Redistributable (x86) - 14.38.33130" for debugging.
I've reviewed the release notes since 4.34 but can't find anything that seems like it would be a change that could cause this.
Do you have any suggestions for how to proceed?