ReSharper错误:无法转换实例参数类型' System.Security.Principal.IPrincipal

时间:2017-06-13 11:31:42

标签: asp.net-identity resharper identityserver4 visual-studio-2017

在.net核心类项目中,我实现了IClaimsService IdentityServer4.Services。我在该课程中有以下代码

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;
}

在上面的代码主题中标有红色曲线下划线,错误如下

  

无法转换实例参数类型   &#39; System.Security.Principal.IPrincipal [System.Security.Principal,   Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a]&​​#39;至   &#39; System.Security.Principal.IPrincipal [System.Private.CoreLib,   Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e]&#39;

只有,ReSarper将此显示为错误,不确定如何解决此问题。在过滤ReSharper显示其他警告后,此错误将停止显示其他警告

0 个答案:

没有答案