'Is it possible to show error in error page for "ASP.NET Core app failed to start"?

A lot of times when your ASP.NET Core application does not start, you see this page:

enter image description here

This page is different from app.UseDeveloperExceptionPage();.

And debugging this page is hard and sometimes tricky.

Is it possible to somehow get the underlying exception that causes this error and show it in this page?

For example, an instance that this page might be shown is that a DLL is not found. It would be awesome if we could catch that exception and show an <h1> at the bottom

DLL not found. DLL name: Something.dll



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source