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

+3
visual-studio-2017 resharper asp.net-identity identityserver4


source to share


No one has answered this question yet

Check out similar questions:

five
Why can't I use the System.Net.Http package in a solution with a System.Net.Http link?
2
Resharper Test Runner: Could not load file or assembly "System.Windows"
1
System.Net.Http conflict in Watson's speech to text
1
ReSharper XAML Warning: Invalid Resource Type: Expected Type is "Brush", Actual Type is "SolidColorBrush"
0
Could not load file or assembly 'System.Web.RegularExpressions, Version = 4.0.0.0
0
Visual Studio Android solution stops building after colliding with C # version when using MSBuild
0
Failed to build cross-platform apps on Xamarin.forms?
0
Errors when converting .Net Core Web project from VS 2015 to VS 2017
0
EF core - System.InvalidProgramException Common Language Runtime encountered an invalid program
-1
The MarshalByRefObject type is defined in an unreferenced assembly. You have to add assembly reference 'mscorlib, Version = 4.0.0.0



All Articles
Loading...
X
Show
Funny
Dev
Pics