❔ DI Question
I have this code for setting up DI in my worker service project https://pastebin.com/6HH5sBAx
But when I run my code I get this error
What have I set-up wrong?
Pastebin
codeu - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
7 Replies
well the error says a circular dependency was detected so thats a pretty clear point to start
i checked in program.cs and i didn't see i had set up
services...
for the same thing twice, so it means something other than what i thoughtshould probably google it then
I tried changing the
AddSingleton()
to AddTransient()
and same errorbecause that isn't the issue
if Foo requires Bar, and Bar requires Foo that is a circular reference
ohhh, that get's loaded. Could be a DI problem, could be a code smell
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.