-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, 2024 at 4:54
  • I know it. Maybe It could be a compiler error. Error action method had ran but custom view didn't seem. Commented Jul 10, 2024 at 17:50
  • Hi @Onur,Is your problem solved? what can I do for you? Commented Jul 16, 2024 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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.