Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jsquire opened this issue Feb 7, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@jsquire
Copy link
Member

jsquire commented Feb 7, 2024

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

@Gamecock
Copy link

Gamecock commented Feb 7, 2024

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

3 participants