Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Exception: '

$
0
0

I have a Blazor Webassembly project with a controller method as follows:

[HttpGet]    public async Task<List<string>> GetStatesForProfile()    {        IConfigurationSection statesSection = configuration.GetSection("SiteSettings:States");        var sections = statesSection.GetChildren();        var states = statesSection.GetChildren().Select(s => s.Key).ToList<string>();        return states;                }

The razor page calls this method:

private async Task<bool> GetStatesModel(){    try    {        States = await http.GetJsonAsync<List<string>>("api/account/getstatesforprofile");                    ...    }    catch (Exception ex)    {        Console.WriteLine($"Exception: {ex.Message}, Inner: {ex.InnerException.Message}");    }

I get this Exception:

Exception: '<' is an invalid start of a value.

I read these values from appsettings.json file, And there is no '<' in values.

{      "SiteSettings": {    "States": {"New York": ["NYC"],"California": ["Los Angeles", "San Francisco"]    } }

Also I put a breakpoint in the controller method and it doesn't hit.What is this error? Is it from parsing json? and how to resolve this?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>