Open
Description
Various places in the SignInManager
compare the userId
against null
. This is a problem for value types, for example Guid
. I cannot use Guid?
in my TUser
as it needs to implement IEquatable<TKey>
.
public override Guid ConvertIdFromString(string id) => Guid.Parse(id);
This returns Guid.Empty
if id == null
. However Guid.Empty != null
and various places now assume a valid user. I see two possible fixes for this:
- Require
TKey
to be a reference type:null
checks can remain as-is. - Replace
null
checks withdefault
checks:Guid.Empty == default
.
Some places where using a value type is a problem:
Metadata
Metadata
Assignees
Labels
No labels