C
C#4mo 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
Omnissiah
Omnissiah4mo ago
i would start from the breakpoints stuff also by "print to the debug page" you mean returning data to the browser?
hutoanhill
hutoanhillOP4mo ago
no in the debugger not the browser
Omnissiah
Omnissiah4mo 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
hutoanhillOP4mo ago
yep, that code wasent runing.
Want results from more Discord servers?
Add your server