© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
7 replies
Kye

BackgroundService Question

Hello :D

I'd like to get some feedback on the
Microsoft.Extensions.Hosting
Microsoft.Extensions.Hosting
's BackgroundService . The issue i'm facing seems to be a race issue between the Discord client initializing and another hosted service being started and inheriting said client before it is properly initialized. The confusing part is that a second hosted service (the main class handling pretty much the registering of commands, modules, and logging) also inherits the DiscordSocketClient but this service is actually receiving the full initialized instance despite being registered right under InteractionManager. I would love some help on this :(

Code: https://paste.mod.gg/acslcflspkxc/0

Thank you!! :3
BlazeBin - acslcflspkxc
A tool for sharing your source code with the world!
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

❔ Windows BackgroundService
C#CC# / help
3y ago
✅ BackgroundService blocking on Startup
C#CC# / help
3mo ago
BackgroundService and dbcontext memory issue
C#CC# / help
2y ago
❔ How to restart a BackgroundService
C#CC# / help
3y ago