Open dmalanij opened 4 weeks ago
We face same blocking issue. I cloned Confluent.Kafka
and could easily reproduce it simply by changing the target framework of Confluent.Kafka.UnitTests
test project to net48
and then loads of tests fail with the DllNotFoundException
.
Description
When using the libraries in Net 4.8 project (in particular a WebAPI), as of
2.6.0
the initialization of theConfluent.Kafka.Impl.Librdkafka
initialization fails with aDllNotFoundException
and the message:How to reproduce
In a NetFramework project, reference to the latest version of the
Confluent.Kafka
package; as soon as the runtime reaches the Kafka initialization (ie: using theProducerBuilder<,>
) the exception is thrown even if the redist assemblies are in place (in particular in thebin\librdkafka
as thelibrdkafka.redist
package targets take care of).Root cause Analysis
I believe that the problem is hapenning because
2.6.0
has not included the target fornet462
; therefore the initialization goes through the netstandard variation without the automatic path resolution that is present for the cases of net462.Workaround
This can be avoided by simply including a call to
Library.Load(path)
wherepath
contains the location for thelibrdkafka.dll
(which in case can be ~ripped of~ inspired by the logic used by the implementation of theLoadNetFrameworkDelegates
.