Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.47k stars 4.8k forks source link

[BUG] ResourceManager.MachineLearning parameter validation error - MachineLearningRegistryDataVersionResource #46046

Open mike-menaker opened 1 month ago

mike-menaker commented 1 month ago

Library name and version

Azure.ResourceManager.MachineLearning 1.2.0

Describe the bug

I have found another instance of an issue I reported 2 weeks ago (https://github.com/Azure/azure-sdk-for-net/issues/45884).

Some of the MachineLearning responses aren't deserialized correctly. This time it's with MachineLearningRegistryDataVersionResource.

When I call this code:

        var machineLearningRegistryResourceId =
            MachineLearningRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName);
        var machineLearningRegistry = client.GetMachineLearningRegistryResource(machineLearningRegistryResourceId);

        var dataCollection = machineLearningRegistry.GetMachineLearningRegistryDataContainers();
        var dataResource = await dataCollection.GetAsync(name);

        var versions = dataResource.Value.GetMachineLearningRegistryDataVersions();
        var versionId = MachineLearningRegistryDataVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName,
            registryName, name, dataResource.Value.Data.Properties.LatestVersion);
        var latestVersion = await versions.GetAsync(versionId);

the last line throws this exception: An unhandled exception has occurred while executing the request. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'resourceType') at Azure.Core.ResourceType..ctor(String resourceType) at Azure.ResourceManager.MachineLearning.MachineLearningDataVersionData.DeserializeMachineLearningDataVersionData(JsonElement element, ModelReaderWriterOptions options) at Azure.ResourceManager.MachineLearning.RegistryDataVersionsRestOperations.Get(String subscriptionId, String resourceGroupName, String registryName, String name, String version, CancellationToken cancellationToken) at Azure.ResourceManager.MachineLearning.MachineLearningRegistryDataVersionResource.Get(CancellationToken cancellationToken) at ScienceCatalog.Controllers.ToolController.GetSasUri(String name) in C:\Users\mikemenaker\source\repos\science-catalog\science-catalog\Controllers\ToolController.cs:line 92 at lambda_method5(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure

Expected behavior

I can fetch a MachineLearningRegistryDataVersionResource object with operations and data.

Actual behavior

An exception is thrown.

Reproduction Steps

    var machineLearningRegistryResourceId =
        MachineLearningRegistryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, registryName);
    var machineLearningRegistry = client.GetMachineLearningRegistryResource(machineLearningRegistryResourceId);

    var dataCollection = machineLearningRegistry.GetMachineLearningRegistryDataContainers();
    var dataResource = await dataCollection.GetAsync(name);

    var versions = dataResource.Value.GetMachineLearningRegistryDataVersions();
    var versionId = MachineLearningRegistryDataVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName,
        registryName, name, dataResource.Value.Data.Properties.LatestVersion);
    var latestVersion = await versions.GetAsync(versionId);

Environment

.NET SDK: Version: 8.0.304 Commit: 352dc5a01f Workload version: 8.0.300-manifests.113cb230 MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.304\

.NET workloads installed: [aspire] Installation Source: VS 17.10.35201.131 Manifest Version: 8.1.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json Install Type: FileBased

Host: Version: 8.0.8 Architecture: x64 Commit: 08338fcaa5

.NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 6.0.321 [C:\Program Files\dotnet\sdk] 6.0.425 [C:\Program Files\dotnet\sdk] 8.0.304 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [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

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

jsquire commented 1 month ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.