Error "Unable to load DLL twApi.dll" received unexpectedly during run
For one project we use the Thingworx Edge SDK for C#. Most of the time we are able to transfer data from our C# application to the cloud. But sometimes, during the application run, we unexpectedly get the following error message:
System.DllNotFoundException: Unable to load DLL 'twApi.dll': Attempt to access invalid address. (Exception from HRESULT: 0x800701E7) at com.thingworx.communications.client.TwApiWrapper.twW_SetLoggerProperties(TwApiLogLevel level, Byte isVerboseEnabled, TwLogMessageDelegate onLogMessage) at com.thingworx.communications.client.TwApiWrapper.ConfigureTwApiLogger() at com.thingworx.communications.client.TwApiWrapper.Initialize(ClientConfigurator config) at com.thingworx.communications.client.BaseClient.initialize() at com.thingworx.communications.client.BaseClient..ctor(ClientConfigurator config) at com.thingworx.communications.client.ConnectedThingClient..ctor(ClientConfigurator config) at My.Project.Class.Communication.ThingworxClient..ctor(ClientConfigurator config)
The error message seems strange since the *.dll files always live in the output directory under tw/x86/ (we only use 32 bit) and sometimes even worked for hours until the error occures for the first time. I highly appreciate any hint and feedback regarding this issue.
Re: Error "Unable to load DLL twApi.dll" received unexpectedly during run
One workaround we recently found (which is still unreliable) is uninstalling our application (through programs and features) and removing any Visual C++ redistributable packages larger than 2008, and then rebooting the system. After reinstalling the application, it will work for an indefinite period of time.
We still appreciate any solution for this problem!