Daryl
Daryl
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Ok no worries, thank you!
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
authenticationState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authenticationState.User;
var userId = await userManager.GetUserIdAsync(user);
authenticationState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authenticationState.User;
var userId = await userManager.GetUserIdAsync(user);
The error I'm getting is: Argument 1: cannot convert from 'System.Security.Claims.ClaimsPrincipal' to 'MyApp.Data.ApplicationUser' But this seemed to be fine when I wasn't doing the async version
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Another question, I changed a method to it's async version but I'm getting an error
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Ok great, thank you. I hadn't considered that the cookies etc can be accessed by services. That'll make things a lot easier
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
I just assumed it would have to be on the page.
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Oh interesting, I didn't realise the service could access that data
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
I seem to have to reverse-engineer their claims to get their userId and then I can do a Linq Query based on it.
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
If you were writing an application with a Database and the User should only see their Accounts, how would you implement that?
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Thanks!
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
My big mistake was thinking the method would continue processing
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Yeah that makes sense. I don't really need that method at all now I understand it a bit better.
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Ok, good to know. I always found it interesting that you can access the data as normal afterwards.
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
So in the example you just gave: - task is assigned a task but that represents the async work - You then print cheese - Then you are waiting for the task to finish and then I guess the variable is changed from a task to the actual result?
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Ok sorry just bare with me here, I'm struggling as it is without getting the terminology exact
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
I pushed enter too early
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
So in the example you just gave: - task is assigned an empty task
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
You can wait a variable?
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
AH lightbulb moment
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
Thread Pools bit out of my league at the moment but it sounds like that's where I've been tripping up. I thought it would carry on because a Task has been returned, even if it's technically an empty task for now.
153 replies
CC#
Created by Daryl on 2/12/2024 in #help
Blazor Pages rendering before async methods finish, breaking the page?
but "other work" is not anything to do with the function we're in
153 replies