NotImplementedException while calling Microsoft.Azure.Devices.ServiceClient.CreateFromConnectionString

EE NTU 96 Reputation points
2022-08-06T08:09:47.027+00:00

First, I am trying to make a Hololens app that can interact with IoT devices by Unity, and I just add Microsoft.Azure.Devices.dll into my Assets/Plugins folder and then add other .dll files until there is no compile error.
Now, when I call

s_serviceClient = ServiceClient.CreateFromConnectionString(HubConnectionString, TransportType.Amqp);  

I got a NotImplementedException, and the error message is like

228705-error.png

What's going wrong?

Thanks.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,415 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,128 questions
HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
385 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sander van de Velde 29,271 Reputation points MVP
    2022-08-06T10:08:38.66+00:00

    Hello @EE NTU ,

    it seems you want to connect your hololens as a device to the IoT Hub.

    as seen here, you need to create a DeviceClient:

    var connectionString = "[the connection string of your device]";  
    using var deviceClient = DeviceClient.CreateFromConnectionString(connectionString);  
       
    

    The service client is for controlling the IoT Hub service itself (together with other classes) and it needs the connection string of the IoT hub itself. It's not recommended to expose the IoT Hub connection string outside Azure / inside a device.


  2. Bruce (SqlWork.com) 56,931 Reputation points
    2022-08-06T17:40:30.39+00:00

    One of the design decisions with .netstandard, was while all api methods are defined, they do not need to implemented on all platforms, they are free to throw the not implemented error.

    The error indicates that .net platform hosting your code did not implement an api required by this library. Probably websocket support.