ReSharper error: Unable to convert instance argument type 'System.Security.Principal.IPrincipal
In a .net core class project I have implemented IClaimsService
from IdentityServer4.Services
. I have the following code in this class
protected virtual IEnumerable<Claim> GetStandardSubjectClaims(IPrincipal subject)
{
var claims = new List<Claim>
{
new Claim(JwtClaimTypes.Subject, subject.GetSubjectId()),
new Claim(JwtClaimTypes.AuthenticationTime, subject.GetAuthenticationTimeEpoch().ToString(), ClaimValueTypes.Integer),
new Claim(JwtClaimTypes.IdentityProvider, subject.GetIdentityProvider()),
};
claims.AddRange(subject.GetAuthenticationMethods());
return claims;
}
In the above code, the subject is marked in red and the error looks like this
Cannot convert instance argument type 'System.Security.Principal.IPrincipal [System.Security.Principal, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a]' to 'System.Security.Principal.IPrincipal [System.Private.CoreLib , Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 7cec85d7bea7798e] '
Only, ReSarper shows this as a bug, not sure what to do to fix it. And this error stops showing other warnings, after filtering ReSharper shows other warnings
source to share
No one has answered this question yet
Check out similar questions: