Skip to content

Getting developer exception page when didn't enable it #64140

@fandrei

Description

@fandrei

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When running the code below from VS, I'm always getting the development exception page even though I commented out the code that activates it.

Am I missing something?

public class Program
{
	public static void Main(string[] args)
	{
		var builder = WebApplication.CreateBuilder(args);
		var app = builder.Build();

		//if (app.Environment.IsDevelopment())
		//	app.UseDeveloperExceptionPage();

		app.MapGet("/",
			(HttpContext httpContext) =>
			{
				throw new ApplicationException("TestException");
			});

		app.Run();
	}
}

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

9.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions