I have written a simple application and when I navigate to my edit page the below error pops up.
Microsoft.EntityFrameworkCore.Query[10100]
<
What I am about to post is NOT the answer to this particular question. But it is related so just to save somebody headache I am posting it. I was encountering this same error
System.ObjectDisposedException: Cannot access a disposed object. etc
The following was the code with the bug (can you see it?):
[HttpGet("processs/oxxo-spei/ticket-email/{paymentIdx}")]
public StatusCodeResult ProcessOxxoSpeiTicketEmailAsync(string paymentIdx)
{
var paymentId = paymentIdx.DecodeRef();
var response = _orderEngine.ProcessOxxoSpeiTicketEmailAsync(paymentId);
return StatusCode(200);
}
The following change fixed it:
[HttpGet("processs/oxxo-spei/ticket-email/{paymentIdx}")]
public async Task ProcessOxxoSpeiTicketEmailAsync(string paymentIdx)
{
var paymentId = paymentIdx.DecodeRef();
var response = await _orderEngine.ProcessOxxoSpeiTicketEmailAsync(paymentId);
// ^^^^I HAD FORGOTTEN TO PUT AWAIT
return StatusCode(200);
}
Yes that's right I had forgotten to put "await" before a function that used an EF Core dbcontext. Adding 'await' fixed it. So easy to miss it, especially if you're tired and under deadline.