Issue with Blazor Web Assembly string arrays

Viewed 313

Hoping someone can help me here. A string Array seems to form differently in Blazor Web Assembly from Blazor Server. A String Array declaration in Blazor Server is as expected.

Declaration:

 string[] scopeDefault = new string[] { "myString" }; 

Debug value:

{string[1]}

Now compare with Blazor Web Assembly: Declaration (identical)

string[] scopeDefault = new string[] { "MyString" };

Debug value (wasm)

string[](1)

Note the difference in the construct of the array and the Server version does not have a length attribute. I'm using this in a function that requires an iEnumerable interface. When I try and use the string array in Blazor Server, it's fine. In WASM it breaks with "Children could not be evaluated". I've tried constructing a List and same issue. Here is the full code including use:

        AuthenticationResult result = null;
        try
        {
            string[] scopeDefault = new string[] { "MyString" };
            result = await app.AcquireTokenForClient(scopeDefault).ExecuteAsync();
        }
        catch(Exception ex)
        {
            throw new Exception(ex.Message);
        }

I must be missing something. Any clues anyone ? Thanks

Phil

0 Answers
Related