GlobalHtmlErrorHttpHandler cuases duplicate output for Razor error

If I use a GlobalHtmlErrorHttpHandler (e.g. this.GlobalHtmlErrorHttpHandler = new RazorHandler(“GlobalErrors.cshtml”):wink: and I have an error in the Razor of my view then the output from my GlobalError handler will be duplicated (aka, I see everything twice).

The Razor error I am testing is an opening brace without a closing brace.

If I remove the GlobalHtmlErrorHttpHandler then the Error Response is displayed by the default HTML handler.

I tested this by:

  1. setting up the Razor Rockstars sample
  2. adding a GlobalErrors.cshtml
  3. adding the line ‘this.GlobalHtmlErrorHttpHandler = new RazorHandler(“GlobalErrors.cshtml”);’ to the configure method
  4. adding invalid Razor to Rockstars.cshtml (I remove the first closing brace).

Should be resolved with this commit available from v4.0.51 that’s now available on MyGet.