C
C#8mo ago
hutoanhill

✅ Print to Debug page

How do i print to the debug page? i need to add prints so i can debug some stuff (break points don't take). ive treid Console.WriteLine and Debug.Print but nether work:
public static IEndpointConventionBuilder CustomMapIdentityApi<TUser>(this IEndpointRouteBuilder endpoints,
string verify2faRoleName) where TUser : class, new()
{
...

routeGroup.MapPost("/login", async Task<Results<Ok<AccessTokenResponse>, EmptyHttpResult, ProblemHttpResult>>
([FromBody] LoginRequest login, [FromQuery] bool? useCookies, [FromQuery] bool? useSessionCookies, [FromServices] IServiceProvider sp) =>
{
...
Console.WriteLine($"\n\tRequitesTwoFactor: {result.RequiresTwoFactor}");
Console.WriteLine($"\tIsLockedOut: {result.IsLockedOut}");
Console.WriteLine($"\tSucceeded: {result.Succeeded}\n");
Debug.Print($"\n\tRequitesTwoFactor: {result.RequiresTwoFactor}");
Debug.Print($"\tIsLockedOut: {result.IsLockedOut}");
Debug.Print($"\tSucceeded: {result.Succeeded}\n");
public static IEndpointConventionBuilder CustomMapIdentityApi<TUser>(this IEndpointRouteBuilder endpoints,
string verify2faRoleName) where TUser : class, new()
{
...

routeGroup.MapPost("/login", async Task<Results<Ok<AccessTokenResponse>, EmptyHttpResult, ProblemHttpResult>>
([FromBody] LoginRequest login, [FromQuery] bool? useCookies, [FromQuery] bool? useSessionCookies, [FromServices] IServiceProvider sp) =>
{
...
Console.WriteLine($"\n\tRequitesTwoFactor: {result.RequiresTwoFactor}");
Console.WriteLine($"\tIsLockedOut: {result.IsLockedOut}");
Console.WriteLine($"\tSucceeded: {result.Succeeded}\n");
Debug.Print($"\n\tRequitesTwoFactor: {result.RequiresTwoFactor}");
Debug.Print($"\tIsLockedOut: {result.IsLockedOut}");
Debug.Print($"\tSucceeded: {result.Succeeded}\n");
4 Replies
this_is_pain
this_is_pain8mo ago
i would start from the breakpoints stuff also by "print to the debug page" you mean returning data to the browser?
hutoanhill
hutoanhillOP8mo ago
no in the debugger not the browser
this_is_pain
this_is_pain8mo ago
well, Debug.Print writes to the Debug section of the Output dialog if you don't see anything then code is just not being executed
hutoanhill
hutoanhillOP8mo ago
yep, that code wasent runing.

Did you find this page helpful?