azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Azure.ResourceManager.AppService.Models.SiteConfigProperties serializable issue

Open tombrothers opened this issue 2 years ago • 1 comments
trafficstars

Library name and version

Azure.ResourceManager.AppService 1.0.2

Describe the bug

Serializing SiteConfigProperties seems to cause a side effect that prevents persisting WebSiteData changes. This issue occurs using JSON.Net and System.Text.Json.

Expected behavior

Serializing SiteConfigProperties shouldn't introduce problems.

Actual behavior

Azure.RequestFailedException HResult=0x80131500 Message=Service request failed. Status: 500 (Internal Server Error)

Content: {"Message":"An error has occurred."}

Headers: Cache-Control: no-cache Pragma: no-cache Strict-Transport-Security: REDACTED X-AspNet-Version: REDACTED X-Powered-By: REDACTED x-ms-failure-cause: REDACTED x-ms-ratelimit-remaining-subscription-resource-requests: REDACTED x-ms-request-id: 1e954df3-8e52-4954-88ac-f02babe44a7d x-ms-correlation-request-id: REDACTED x-ms-routing-request-id: REDACTED X-Content-Type-Options: REDACTED X-Cache: REDACTED X-MSEdge-Ref: REDACTED Date: Fri, 01 Sep 2023 19:02:27 GMT Content-Length: 36 Content-Type: application/json; charset=utf-8 Expires: -1

Source=Azure.ResourceManager.AppService StackTrace: at Azure.ResourceManager.AppService.WebAppsRestOperations.<CreateOrUpdateAsync>d__15.MoveNext() at Azure.ResourceManager.AppService.WebSiteCollection.<CreateOrUpdateAsync>d__5.MoveNext() at Program.<<Main>$>d__0.MoveNext() in C:\Users\TomBrothers\source\repos\AppServiceTest\AppServiceTest\Program.cs:line 43

Reproduction Steps

using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.AppService;
using Azure.ResourceManager.AppService.Models;
using Azure.ResourceManager.Resources;

var resourceGroupName = "csappplans";
var appServicePlanName = "csappplan0";
var armClient = new ArmClient(new DefaultAzureCredential(new DefaultAzureCredentialOptions
{
#if DEBUG
    ExcludeManagedIdentityCredential = true,
    ExcludeEnvironmentCredential = true,
#endif
}));
var resourceGroupResourceIdentifier = ResourceGroupResource.CreateResourceIdentifier(
    armClient.GetDefaultSubscription().Id.SubscriptionId,
    resourceGroupName
);
var appServicePlanResourceIdentifier = AppServicePlanResource.CreateResourceIdentifier(
    resourceGroupResourceIdentifier.SubscriptionId,
    resourceGroupResourceIdentifier.ResourceGroupName,
    appServicePlanName
);
var webSiteResourceIdentifier = WebSiteResource.CreateResourceIdentifier(
    resourceGroupResourceIdentifier.SubscriptionId,
    resourceGroupResourceIdentifier.ResourceGroupName,
    $"devtest{DateTime.Now:yyyyMMddHHmmss}"
);
var resourceGroupResource = armClient.GetResourceGroupResource(resourceGroupResourceIdentifier);
var webSiteCollection = resourceGroupResource.GetWebSites();
var newWebSiteData = new WebSiteData(AzureLocation.EastUS)
{
    AppServicePlanId = appServicePlanResourceIdentifier,
    SiteConfig = new SiteConfigProperties()
};

Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(newWebSiteData));
//Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(newWebSiteData));

var operation = await webSiteCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    webSiteResourceIdentifier.Name,
    newWebSiteData
);
var webSiteData = operation.Value.Data;


Console.ReadLine();

Environment

.NET SDK: Version: 7.0.307 Commit: 7b77e35a2b

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

Host: Version: 7.0.10 Architecture: x64 Commit: a6dbb800a4

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

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.10 [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

tombrothers avatar Sep 01 '23 19:09 tombrothers

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

jsquire avatar Sep 02 '23 13:09 jsquire

@tombrothers Thank you for your feedback. Regarding the issue you mentioned, until the latest version 1.1.0-beta.4, this issue has not been resolved. If you need to use the webSiteCollection.CreateOrUpdateAsync() method to obtain the WebSiteResource, you can use an empty WebsiteData to obtain the corresponding Resource. What I want to emphasize is that this bug is related to WebsiteData, not SiteConfigProperties. In version 1.1.0-beta.5, we use System.ClientModel to enable new model serialization, and this bug will also be fixed in version 1.1.0-beta.5.

mcgallan avatar Feb 22 '24 08:02 mcgallan

Hi @tombrothers. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar Feb 22 '24 08:02 github-actions[bot]

Hi @tombrothers, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

github-actions[bot] avatar Mar 04 '24 21:03 github-actions[bot]

Hi @tombrothers. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar Mar 13 '24 07:03 github-actions[bot]

Hi @tombrothers, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

github-actions[bot] avatar Mar 20 '24 10:03 github-actions[bot]