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] AppendChildResource produces incorrect ResourceType #25312

Closed
aelij opened this issue Nov 14, 2021 · 3 comments
Closed

[BUG] AppendChildResource produces incorrect ResourceType #25312

aelij opened this issue Nov 14, 2021 · 3 comments
Assignees
Labels
ARM Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team

Comments

@aelij
Copy link
Member

aelij commented Nov 14, 2021

Describe the bug

new ResourceIdentifier("/subscriptions/794307ce-39e3-4505-bce1-23bd9837bcc7/resourceGroups/g1")
  .AppendProviderResource("microsoft.storage", "accounts", "ac1")
  .AppendChildResource("containers", "c1").ResourceType

Expected behavior
Microsoft.Storage/accounts/containers

Actual behavior (include Exception or Stack Trace)
Microsoft.Resources/containers

To Reproduce
See above

Note that calling new ResourceIdentifier(identifer.ToString()).ResourceType produces the correct result.

Environment:

  • Name and version of the Library package used: Azure.ResourceManager, 1.0.0-beta.5
  • Hosting platform or OS and .NET runtime version (dotnet --info output for .NET Core projects): Windows 11, .NET 5.0
  • IDE and version : VS 2022
@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 14, 2021
@jsquire jsquire added ARM Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Nov 15, 2021
@jsquire
Copy link
Member

jsquire commented Nov 15, 2021

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

@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 15, 2021
@ArcturusZhang
Copy link
Member

Hi @aelij we recently did a little bit refactor on the ResourceIdentifier class. We moved it to Azure.Core.
In the latest version of Azure.Core (1.22.0), you could find this class, and your code is working as expected. Therefore I believe the bug should be fixed.

using Azure.Core;

var id = new ResourceIdentifier("/subscriptions/794307ce-39e3-4505-bce1-23bd9837bcc7/resourceGroups/g1").AppendProviderResource("microsoft.storage", "accounts", "ac1").AppendChildResource("containers", "c1");
Console.WriteLine(id.ToString());
Console.WriteLine(id.ResourceType);

Result of this program:
image
Please give a try with the latest version of Azure.Core to see if this resolves your issue. Thank you!

@aelij
Copy link
Member Author

aelij commented Jan 26, 2022

Thanks, looks like it's fixed

@aelij aelij closed this as completed Jan 26, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ARM Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team
Projects
None yet
Development

No branches or pull requests

4 participants