Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How do you determine your in development environment before calling AddDatabaseDeveloperPageExceptionFilter()

$
0
0

According to the documentation AddDatabaseDeveloperPageExceptionFilter() should only be called in the development environment.

The question is how do you determine you are in the development environment before the app has been created? The usual why to determine you are in the development environment is to call app.Environment.IsDevelopment(). The trouble is you have to call builder.Services.AddDatabaseDeveloperPageExceptionFilter() before app = builder.Build() but you can not call builder.Services.AddDatabaseDeveloperPageExceptionFilter() after the app is built.

It is interesting to note that when you create Blazor or ASP.Net core project they both simply call builder.Services.AddDatabaseDeveloperPageExceptionFilter() without regard to the current environment.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>