Closed
Description
The built-in Bind method annotates the object as nullable:
public static void Bind(this IConfiguration configuration, object? instance)
and then explicitly nops if it's null:
if (instance != null)
{
...
}
In contrast, the code generated by the generator annotates it as non-nullable and throws an exception if it's null, changing the semantics when using the source generator.
if (obj is null)
{
throw new ArgumentNullException(nameof(obj));
}
(It also names the parameter obj
instead of instance
.)