Azure / azure-iot-sdk-csharp

A C# SDK for connecting devices to Microsoft Azure IoT services
Other
457 stars 493 forks source link

Getting PlatformNotSupportedException on .NET Framework 4.6.1 #3445

Closed dheerajawale-svg closed 3 months ago

dheerajawale-svg commented 4 months ago

I am trying to use Microsoft.Azure.Devices.Client for a legacy WinForms application (.NET 4.6.1), as I need to use Azure IOT device client to send events from a custom joystick connected to WinForms app.

When trying to create an instance like below with MQTT type, It throws "Operation is not supported on this platform." error. DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(deviceConnectionString, TransportType.Mqtt, options);

If tried with HTTP then it throws: "Plug and Play is not supported over the HTTP transport."

Please help!

List of packages used:

<package id="Azure.Core" version="1.36.0" targetFramework="net461" />
<package id="Azure.Storage.Blobs" version="12.19.1" targetFramework="net461" />
<package id="Azure.Storage.Common" version="12.18.1" targetFramework="net461" />
<package id="DotNetty.Buffers" version="0.7.5" targetFramework="net461" />
<package id="DotNetty.Codecs" version="0.7.5" targetFramework="net461" />
<package id="DotNetty.Codecs.Mqtt" version="0.7.5" targetFramework="net461" />
<package id="DotNetty.Common" version="0.7.5" targetFramework="net461" />
<package id="DotNetty.Handlers" version="0.7.5" targetFramework="net461" />
<package id="DotNetty.Transport" version="0.7.5" targetFramework="net461" />
<package id="Microsoft.Azure.Amqp" version="2.5.12" targetFramework="net461" />
<package id="Microsoft.Azure.Devices" version="1.39.1" targetFramework="net461" />
<package id="Microsoft.Azure.Devices.Client" version="1.42.2" targetFramework="net461" />
<package id="Microsoft.Azure.Devices.Shared" version="1.30.4" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="5.0.0" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.24" targetFramework="net461" />
<package id="Microsoft.Win32.Registry" version="4.5.0" targetFramework="net461" />
<package id="MQTTnet" version="4.3.3.952" targetFramework="net461" />
timtay-microsoft commented 4 months ago

Can you provide the stacktrace on the "Operation is not supported on this platform" error?

timtay-microsoft commented 3 months ago

@dheerajawale-svg ?

timtay-microsoft commented 3 months ago

Closing due to inactivity