question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] retentionInDaysAsDefault property is an invalid type

See original GitHub issue

Library 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

  1. Navigate to the TablesGet example found here: https://learn.microsoft.com/en-us/rest/api/loganalytics/tables/get?tabs=dotnet#tablesget
  2. Select the dotnet tab
  3. Create or use an existing dotnet project
  4. Copy the code from the dotnet tab into your project
  5. Create a Log Analytics workspace or use an existing Log Analytics workspace
  6. Create tables if none exist in your Log Analytics Workspace
  7. In the copied code, enter your subscriptionId, resourceGroupName, workspaceName, and tableName
  8. Run the code

Environment

Azure.ResourceManager.OperationalInsights 1.2.0-beta.1

Issue Analytics

  • State:open
  • Created 2 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mcgallancommented, Aug 8, 2023

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

1reaction
jsquirecommented, Jul 8, 2023

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::Logs::LogGroup - AWS CloudFormation
A log group defines common properties for log streams, such as their retention and access control rules. Each log stream must belong to...
Read more >
Error deploying AWS Cloudformation LogGroup but it still ...
1 Answer 1 ... This is correct behaviour because the log group doesn't have the property DeletionPolicy set to Delete . The default...
Read more >
Backup Short Term Retention Policies - Create Or Update
400 InvalidBackupRetentionPeriod - The retention days of {0} is not a valid configuration. Valid backup retention in days must be between ...
Read more >
AWS Lambda Guide - Serverless.yml Reference
Here is a list of all available properties in serverless.yml when the provider is ... (fatal error), 'warn' (logged to the output) or...
Read more >
Need help "Error Encountered an invalid type for a default ...
Im using ASP .NET MVC4, i got some error when i access controller Error Encountered an Invalid value, but I can't locate that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found