© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
15 replies
Thalnos

❔ ✅ I feel like I've gotten lost in what I'm doing right now, pls help.

public async Task DisplayUpdatedTicketsAsync(){
    await UpdateTicketsAsync();
    DisplayTickets(); //exception thrown here because only UI Thread may access stuff from UI
}
public async Task DisplayUpdatedTicketsAsync(){
    await UpdateTicketsAsync();
    DisplayTickets(); //exception thrown here because only UI Thread may access stuff from UI
}

Now this is the first time I ever experienced thread synchronization issues and I'm a little lost on what to do.

I found a solution but its not very conveniant so I was hoping for a different one:

public async Task DisplayUpdatedTicketsAsync(){
    await UpdateTicketsAsync();
    Dispatcher.Invoke(() => { DisplayTickets(); }); //here we say wait until thread XY is done with updating Tickets before we let UI thread display the updated tickets
}
public async Task DisplayUpdatedTicketsAsync(){
    await UpdateTicketsAsync();
    Dispatcher.Invoke(() => { DisplayTickets(); }); //here we say wait until thread XY is done with updating Tickets before we let UI thread display the updated tickets
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ I am Kinda lost right now
C#CC# / help
3y ago
I feel i am lost
C#CC# / help
7mo ago
❔ I'm not sure what I'm doing wrong
C#CC# / help
4y ago
Not understanding what I'm doing wrong
C#CC# / help
4y ago