Search code examples
c#.netazure-iot-hub

Cannot create valid ProvisioningTransportHandlerMqtt


I am trying to create a IoT DPS device with a symmetric key, For that to work, I need a ProvisioningTransportHandlerMqtt.

I have tried the console application fromlearn: https://learn.microsoft.com/en-us/azure/iot-dps/how-to-legacy-device-symm-key?tabs=windows&pivots=programming-language-csharp and I can provision devices with it.

I have tried making an interactive .Net notebook, and I can also provision devices from that: enter image description here

The issue is only in my own cs file. When I try to run a similar line in a cs file the object is different: enter image description here

The samplecode from Microsoft produces a valid transportHandeler: enter image description here

I have no clue how to create a proper transportHandler. How do I get a proper ProvisioningTransportHandlerMqtt()?


Solution

  • Turned out including the DotNetty dlls in my app solved the issue.