Closed surabhshah closed 6 years ago
Hi Surabh Shah,
From the error looks like your modbus module or some of it's dependency is missing, or there is an architecture mismatch.
Things you can do to debug: 1-Remove the dotnet module to make sure your modbus modules loads; 2-Run tools like (Dependency Walker) to check if you are missing any of your dependency; 3-Run in Debug mode and check if you get any exception or error and what are this error for modbus module.
Let us know,
Thanks,
Angelo Ribeiro.
On Tue, Nov 14, 2017 at 6:02 AM, Surabh Shah notifications@github.com wrote:
Hello All,
I am trying to build a custom module in .NET Framework which would post data to IoT hub after a bit of processing. My solution is working with a simulator inside the solution. But, when I try to use the modbus module, I get error 193 as in the below screen.
[image: 1] https://user-images.githubusercontent.com/8298707/32783512-0a02b3d4-c972-11e7-97f3-0f2ee2ba708d.PNG
The JSON file and the modbus_read.dll are present in the bin folder of the project. Please help me if I am doing anything wrong.
My JSON looks something like this.
"modules": [ { "name": "sample_module", "loader": { "name": "dotnet", "entrypoint": { "assembly.name": "DotNetModuleSample", "entry.type": "DotnetModuleSample.SampleModule" } }, "args": { "iotHubName": "DaveyIoTHub", "deviceId": "myFirstDevice", "deviceKey": "Te+5KogkorfzV9xnSXz2gS13P1f9p0QmZ6Kj95cKPBA=" } }, { "name": "modbus_read", "loader": { "name": "native", "entrypoint": { "module.path": "modbus_read.dll" } }, "args": [ { "serverConnectionString": "127.0.0.1", "interval": "2000", "macAddress": "01:01:01:01:01:01", "baudRate": "9600", "stopBits": "1", "dataBits": "8", "parity": "EVEN", "flowControl": "NONE", "deviceType": "powerMeter", "sqliteEnabled": "0", "operations": [ { "unitId": "1", "functionCode": "3", "startingAddress": "1", "length": "1" } ] } ] } ], "links": [ { "source": "modbus_read", "sink": "sample_module" }
Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Azure/iot-edge/issues/410, or mute the thread https://github.com/notifications/unsubscribe-auth/AI75b6ZYHGnWPop4aeObsgOMqQmLf5qQks5s2Z1zgaJpZM4QdYlG .
Angelo Ribeiro Msc - Federal University of Pernambuco Team in Training Alumni Triple Crowned! :)
Hey Angelo,
Thanks for an express reply. I took up your debug steps and following are the observations and results from those.
1-Remove the dotnet module to make sure your modbus modules loads
----> Tried it. The modbus module still does not appear to be loading. The execution stops without any exception or error.
2-Run tools like (Dependency Walker) to check if you are missing any of your dependency
----> That was an amazing suggestion. But seems that apart from API-MS-WIN- & EXT-MS-WIN- dependencies rest all are met which is fine I guess. Attaching the screen below for same. Request you to still review it once.
3-Run in Debug mode and check if you get any exception or error and what are this error for modbus module.
----> Tried running it in debug mode. But the VS 2017 is not able to debug the modbus module (as it is not loaded I guess). I am able to debug my dotnet module but it exits as expected without issues immediately after loading.
Posting some other findings from my side as it might lead us somewhere.
The error is occurring in dynamic_library_windows.c placed under adapters of core IoT edge SDK on line number 13 I guess. The thing I felt strange is, that the function is returning NULL without posting any further errors on the console. Could you throw some light on this if possible?
Hope this helps.
Thanks, Surabh
Hi Surabh,
Did you check the platform. Seems like all your dependencies are showing on your dependency walker as 64bits and your modbus dll is 32 bits. Can you compile the gateway as x86 or your modbus module as x64 and try again?
Thanks,
Angelo Ribeiro.
On Wed, Nov 15, 2017 at 2:57 AM, Surabh Shah notifications@github.com wrote:
Hey Angelo,
Thanks for an express reply. I took up your debug steps and following are the observations and results from those.
1-Remove the dotnet module to make sure your modbus modules loads
----> Tried it. The modbus module still does not appear to be loading. The execution stops without any exception or error.
2-Run tools like (Dependency Walker) to check if you are missing any of your dependency
----> That was an amazing suggestion. But seems that apart from API-MS-WIN- & EXT-MS-WIN- dependencies rest all are met which is fine I guess. Attaching the screen below for same. Request you to still review it once.
[image: 2] https://user-images.githubusercontent.com/8298707/32832268-e897c702-ca20-11e7-8b41-88dddee89db0.PNG
3-Run in Debug mode and check if you get any exception or error and what are this error for modbus module.
----> Tried running it in debug mode. But the VS 2017 is not able to debug the modbus module (as it is not loaded I guess). I am able to debug my dotnet module but it exits as expected without issues immediately after loading.
Posting some other findings from my side as it might lead us somewhere.
The error is occurring in dynamic_library_windows.c placed under adapters of core IoT edge SDK on line number 13 I guess. The thing I felt strange is, that the function is returning NULL without posting any further errors on the console. Could you throw some light on this if possible?
[image: 3] https://user-images.githubusercontent.com/8298707/32832315-13630456-ca21-11e7-9f5f-fc118fbefef2.PNG
Hope this helps.
Thanks, Surabh
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Azure/iot-edge/issues/410#issuecomment-344558068, or mute the thread https://github.com/notifications/unsubscribe-auth/AI75bxXQ16Otj-ToH5MOZKx-pmgg_x-4ks5s2sOogaJpZM4QdYlG .
Angelo Ribeiro Msc - Federal University of Pernambuco Team in Training Alumni Triple Crowned! :)
Hi Angelo,
Thanks for the reply, was a bit busy so was unable to update the status. I guess the gateway and the modbus are built in x86 architecture as I built them simultaneously and the dependencies shown in x64 are because of my system(OS) architecture. But I would still try to build the modbus and the gateway in same architecture and post my further observations.
Thanks, Surabh
I have the same issue with both Debug and Release version
Error: Time:Mon Nov 20 23:37:49 2017 File:C:\agent_work\7\s\iot-edge\core\adapters\dynamic_library_windows.c Func:DynamicLibrary_LoadLibrary Line:17 Error Loading Library. Error code is: 193
Error: Time:Mon Nov 20 23:37:49 2017 File:C:\agent_work\7\s\iot-edge\core\src\module_loaders\dynamic_loader.c Func:DynamicModuleLoader_Load Line:72 DynamicLibrary_LoadLibrary() returned NULL for module modbus_read.dll
Error: Time:Mon Nov 20 23:37:49 2017 File:C:\agent_work\7\s\iot-edge\core\src\gateway_internal.c Func:gateway_addmodule_internal Line:400 Failed to add module because the module could not be loaded.
Error: Time:Mon Nov 20 23:37:49 2017 File:C:\agent_work\7\s\iot-edge\core\src\gateway_createfromjson.c Func:Gateway_CreateFromJson Line:78 Failed to create gateway using lower level library.
Error: Time:Mon Nov 20 23:37:49 2017 File:C:\agent_work\7\s\src\gw\src\main.c Func:main Line:50 An error occurred while creating the gateway.
Hello,
Unable to get it going. I have shifted to V2 for IoT Edge and also to respective Modbus module which is working fine. The newer version is quite sleek to use and would most probably would stick to that. Anyways, @aribeironovaes (Angelo Ribeiro) thanks for your kind help and support. We can keep this issue going if anybody else is trying it out or else close it.
Thanks, Surabh
Hello Surabh, I quite new to IoT, I am trying to make modbus module work on my local system. May i know which Modbus Simulator you are working on
Hello All,
I am trying to build a custom module in .NET Framework which would post data to IoT hub after a bit of processing. My solution is working with a simulator inside the solution. But, when I try to use the modbus module, I get error 193 as in the below screen.
The JSON file and the modbus_read.dll are present in the bin folder of the project. Please help me if I am doing anything wrong.
My JSON looks something like this.
Thanks!