No developer exception page in asp.net 5 razor pages?

  Uncategorised

I have a simple asp.net 5 razor pages app which would repeatedly show this in the browser developer tools

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

After many iterations and debugging it turns out there was a simple typo in the sql query and instead of showing the developer error page, it was showing blank with the aforementioned error in the browser console !

Questions –

  • Is this normal/expected ?
  • any way to turn on "more" debugging to identify such errors rather than trial and error ?

environment –

  • Visual studio 2019, .net 5
  • db access using dapper v2.0.78
  • configure excerpts below !
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<Startup> logg)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseMigrationsEndPoint();
            }
            else
            {
                app.UseDeveloperExceptionPage();
                //app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
              ...

Source: Visual Studio Questions

LEAVE A COMMENT