When you have a dependency with a default (null) argument and have null injection enabled on the kernel, when targeting net6.0, it will throw an InvalidProgramException (Common Language Runtime detected an invalid program). On net5.0 it succeeds happily.
An example of a dependency with the scenario:
class ClassWithOptionalArgument
{
public ClassWithOptionalArgument(string keyPrefix = null)
{
Console.WriteLine(keyPrefix);
}
}
When you have a dependency with a default (null) argument and have null injection enabled on the kernel, when targeting net6.0, it will throw an InvalidProgramException (Common Language Runtime detected an invalid program). On net5.0 it succeeds happily.
An example of a dependency with the scenario:
A full repro can be found here: Repro repo