Closed MarkitoAlmeida closed 3 years ago
@MarkitoAlmeida thanks for contacting us.
The error that you are seeing means you have a null reference exception in the code that renders your component markup. Make sure that the data in your page is initialized to a non-null value or check for null when you are rendering the view.
In your case it is likely caused by the render that happens while the request for data is being processed. Try set an empty array to order.OrderEspecifications and that likely will solve your problem.
Checkout here for more details on how the Blazor rendering process works.
Thank you, @javiercn for your explanation.
Worked fine.
Best regards, Marcos
Hi.
I am working with an APS.NET Blazor client-side application and I am having an issue that I can't understand why is happening.
This is the message I get when the error occurs:
I have an API that I send a request, like:
public async Task RowExpand(Order order) { if (order.OrderEspecifications == null) { HttpClient httpClient = new HttpClient(); order.OrderEspecifications= await httpClient.GetFromJsonAsync<OrderEspecification>("https://localhost:44364/Order/OrderEspecification/" + order.OrderId); } }
The nested JSON I must recieve is:
`{ "idOrder" : 101010. "articles" : [ { "idArticle" : 202020, "articleName" : "ArticleOne", ...
}, ... ] }`
But everytime I send the request to get this JSON I get the error I mentioned. Don't even finish the debbug. Need help to understand what is this happening.