InvalidOperationException: Could not create an instance of type 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment'. Model bound complex types must not be abstract or value types and must have a parameterless constructor. Record types must have a single primary constructor. Alternatively, give the 'environment' parameter a non-null default value.

  • Uchenna's Display Picture

    Original Post

    Uchenna encountered this error in the wild and fixed it in 2 minutes on their second attempt.