-1

I added a new property in a entity class. I didn't create migration. After that, I tried to use UseExceptionHandler middleware. It successfully triggered error action method but the view didn't appear. Instead, the default developer exception page was displayed. I wonder why this happened. Later, I added new migration and updated the database. After doing so, the middleware worked as expected.

I tried to use UseExceptionHandler middleware. The view didn't appear.

3
  • select [newcolumn] will throw an exception if it doesn't exist. I'm not sure why you are surprised by that. Commented Jul 10 at 4:54
  • I know it. Maybe It could be a compiler error. Error action method had ran but custom view didn't seem.
    – Onur
    Commented Jul 10 at 17:50
  • Hi @Onur,Is your problem solved? what can I do for you?
    – XieMan
    Commented Jul 16 at 9:30

1 Answer 1

0

Enables the Developer Exception Page when ASPNETCORE_ENVIRONMENT is set to Development. This is done automatically by the WebApplication.CreateBuilder method. Calls UseExceptionHandler when the value of ASPNETCORE_ENVIRONMENT is anything other than Development. you can delete "!" or remove the judgment condition.

Here's an example:

1) delete "!"

if (app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

2)remove the judgment condition

app.UseExceptionHandler("/Home/Error");
app.UseHsts();

The result is as follows:

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.