Azure/azure-iot-sdk-csharp

[BUG] error CS0426: The type name 'Create' does not exist in the type 'ServiceClient'

jsquire opened this issue · 1 comments

Issue Transfer

This issue has been transferred from the Azure SDK for .NET repository, #41818.

Please be aware that @Gamecock is the author of the original issue and include them for any questions or replies.

Details

Library name and version

Microsoft.Azure.Devices Version="1.39.1"

Describe the bug

ServiceClient serviceClient = new ServiceClient.Create("hostname", credential, TransportType.Amqp_WebSocket_Only);

fails to compile

Expected behavior

compile or more meaningful error.

Actual behavior

error CS0426: The type name 'Create' does not exist in the type 'ServiceClient'

Reproduction Steps

Packages included

using Azure.Core;
using Azure.Identity;
using Azure.Messaging.EventHubs;
using Microsoft.Azure.Devices;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;


        public OPLRouting(ILogger<OPLRouting> logger)
        {
            _logger = logger;
            DefaultAzureCredential defaultAzureCredential = new DefaultAzureCredential();
            ServiceClient serviceClient = new ServiceClient.Create(hostname,
                                                    defaultAzureCredential, TransportType.Amqp_WebSocket_Only);
                }

Environment

$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.402
Commit: 6862418796

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.402\

Host:
Version: 8.0.1
Architecture: x64
Commit: bf5e279d92

.NET SDKs installed:
6.0.402 [C:\Program Files\dotnet\sdk]
8.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

This can be closed. The new is not required. Would be nice if C# or VSCode gave a better error.

        ServiceClient serviceClient = new ServiceClient.Create(hostname,
                                                defaultAzureCredential, TransportType.Amqp_WebSocket_Only);