danclarke,
@danclarke@mstdn.social avatar

Just been banging my head against a wall trying to work out why an injected dependency was coming through as null in a WebApplicationFactory test.
Turned out it was because I was doing the injection via a primary constructor, and switching to a normal constructor fix it! I assumed primary constructors were just syntax sugar - so this is surprisingly unexpected.
Anyone know why primary constructors would behave differently for DI?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • dotnet
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines