[BUG] retentionInDaysAsDefault property is an invalid type
See original GitHub issueLibrary name and version
Azure.ResourceManager.OperationalInsights 1.2.0-beta.1
Describe the bug
Problem:
During the property set for retentionInDaysAsDefault, an exception is thrown during GetString()
for the JsonProperty retentionInDaysAsDefault. Location of failure can be found here: https://github.com/Azure/azure-sdk-for-net/blob/4cac8641bbe88435ef21da3e7be8505f89c68cd0/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Models/OperationalInsightsTableData.Serialization.cs#L205
Notes:
I’m attempting to check for the existence of a table in my log analytics workspace using the “TableGet” dotnet example code provided by Microsoft. Example code can be found here: https://learn.microsoft.com/en-us/rest/api/loganalytics/tables/get?tabs=dotnet#tablesget
During debugging, the table is found, and the JsonElement data is:
ValueKind = Object : "{"properties":{"totalRetentionInDays":30,"archiveRetentionInDays":0,"plan":"Analytics","retentionInDaysAsDefault":true,"totalRetentionInDaysAsDefault":true, ...
Expected behavior
A response from ExistsAsync
with a boolean value and an exception is not thrown.
Actual behavior
Unhandled exception. System.InvalidOperationException: The requested operation requires an element of type 'String', but the target element has type 'True'.
at System.Text.Json.ThrowHelper.ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
at System.Text.Json.JsonDocument.CheckExpectedType(JsonTokenType expected, JsonTokenType actual)
at System.Text.Json.JsonDocument.GetString(Int32 index, JsonTokenType expectedType)
at Azure.ResourceManager.OperationalInsights.OperationalInsightsTableData.DeserializeOperationalInsightsTableData(JsonElement element)
at Azure.ResourceManager.OperationalInsights.TablesRestOperations.GetAsync(String subscriptionId, String resourceGroupName, String workspaceName, String tableName, CancellationToken cancellationToken)
at Azure.ResourceManager.OperationalInsights.OperationalInsightsTableCollection.ExistsAsync(String tableName, CancellationToken cancellationToken)
Reproduction Steps
- Navigate to the TablesGet example found here: https://learn.microsoft.com/en-us/rest/api/loganalytics/tables/get?tabs=dotnet#tablesget
- Select the
dotnet
tab - Create or use an existing dotnet project
- Copy the code from the
dotnet
tab into your project - Create a Log Analytics workspace or use an existing Log Analytics workspace
- Create tables if none exist in your Log Analytics Workspace
- In the copied code, enter your
subscriptionId
,resourceGroupName
,workspaceName
, andtableName
- Run the code
Environment
Azure.ResourceManager.OperationalInsights 1.2.0-beta.1
Issue Analytics
- State:
- Created 2 months ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Hi @kramerd1 ,this issue has been noted and fixed by the service team, and we will complete the fix in subsequent releases,thank you for your feedback
Thank you for your feedback. Tagging and routing to the team member best able to assist.