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

[Sample Issue dotnet] TablesListByWorkspace encounters System.InvalidOperationException #3928

Open
2 of 9 tasks
morgans07 opened this issue Nov 30, 2023 · 0 comments
Open
2 of 9 tasks
Assignees
Labels
customer-reported question Further information is requested

Comments

@morgans07
Copy link

Link to sample

https://learn.microsoft.com/en-us/rest/api/loganalytics/tables/list-by-workspace?view=rest-loganalytics-2022-10-01&tabs=dotnet

Library name and version

Azure.ResourceManager.OperationalInsights 1.2.0

Language of the Sample

  • C#/.NET
  • Java
  • JavaScript/TypedScript
  • Python
  • Golang
  • Other - Please specify in Issue details field

Sample Issue Type

  • Sample not working
  • Sample missing
  • Do not understand sample

Issue details

When running the sample, I receive the following exception when calling collection.GetAllAsync():

System.InvalidOperationException: 'The requested operation requires an element of type 'String', but the target element has type 'True'.'

It seems to happen here:

// File: Models\OperationalInsightsTableData.Serialization.cs

if (property0.NameEquals("retentionInDaysAsDefault"u8))
{
    if (property0.Value.ValueKind == JsonValueKind.Null)
    {
        property0.ThrowNonNullablePropertyIsNull();
        continue;
    }
   // Exception thrown here
    retentionInDaysAsDefault = new RetentionInDaysAsDefaultState(property0.Value.GetString());
    continue;
}

If I try to do the following:

// This table exists. Same exception.
var table = collection.Get("AACAudit");

// This table does not exist. No exception thrown.
var table = collection.Get("madeuptable");

Expected behavior

I would expect the call to successfully complete without throwing an exception.

Actual behavior

The call always throws an exception even when using different log analytic workspaces that I have access to.

Reproduction Steps

Run the sample with a valid subscriptionId, resourceGroupId, and workspace name.

Environment

.NET SDK:
Version: 7.0.306
Commit: f500069cb7

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64

Host:
Version: 7.0.14
Architecture: x64
Commit: 808851b07a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants