AspNetCore.Identity.DocumentDb icon indicating copy to clipboard operation
AspNetCore.Identity.DocumentDb copied to clipboard

TypeLoadException: Method 'NormalizeName' in type 'LookupNormalizer' does not have an implementation

Open lostmsu opened this issue 5 years ago • 5 comments
trafficstars

Just created new empty ASP.NET Core 3.1 project, added CodeKoenig.AspNetCore.Identity.DocumentDb, and facing this exception:

System.TypeLoadException: Method 'NormalizeName' in type 'AspNetCore.Identity.DocumentDb.LookupNormalizer' from assembly 'CodeKoenig.AspNetCore.Identity.DocumentDb, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.\r\n at AspNetCore.Identity.DocumentDb.IdentityDocumentDbBuilderExtensions.AddDocumentDbStores(IdentityBuilder builder, Action`1 setupAction)\r\n at CosmosIdentity.Startup.ConfigureServices(IServiceCollection services)

The whole project file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="CodeKoenig.AspNetCore.Identity.DocumentDb" Version="2.0.0" />
  </ItemGroup>

</Project>

This is the only change I made to the template code:

public void ConfigureServices(IServiceCollection services) {
    services.AddSingleton<IDocumentClient>(new DocumentClient(
        serviceEndpoint: new Uri("https://localhost:8081/"),
        authKeyOrResourceToken: "LOCAL"));

    services.AddIdentity<DocumentDbIdentityUser, DocumentDbIdentityRole>()
        .AddDocumentDbStores(options => {
            options.Database = "CosmosIdentity";
            options.UserStoreDocumentCollection = "AspNetIdentity";
        })
        .AddDefaultTokenProviders();
}

lostmsu avatar Mar 29 '20 06:03 lostmsu

Seems to be related to 775d9e30dcc8cda58ca232f253633710c0648f5a

Any idea why .NET Standard version is not forward-compatible with .NET Core 3.1/.NET Standard 2.1?

Actually, according to https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.ilookupnormalizer?view=aspnetcore-3.1 these methods should have existed in every ASP.NET Core version.

lostmsu avatar Mar 29 '20 06:03 lostmsu

I have the same problem.

It looks like @RichMercer fixed this and had his changes merged under commit e279eae that was somehow overwritten by the later commit 775d9e3.

It's late here but I will probably have a dig tomorrow to see if I can re-instate the changes without breaking anything and create a pull request.

RossMMason avatar Apr 26 '20 01:04 RossMMason

I was getting the same exception when I added the nuget package to my project. The exception is gone and the library works as expected however when you clone the project and reference it from your machine such as: <ItemGroup> <ProjectReference Include="..\AspNetCore.Identity.DocumentDb\AspNetCore.Identity.DocumentDb.csproj" /> </ItemGroup>

steveage avatar May 17 '20 23:05 steveage

Is there any chance on getting this fixed in the nuget package?

BTW the above fix does not work for me.

ashlar64 avatar Aug 04 '20 16:08 ashlar64

Unfortunately I do not have time to take care of this package on a regular basis - any co-maintainers would still be very welcome. I updated the project to consent with new NuGet metadata properties and published it now as version 3.0 to NuGet. It should appear shortly.

The mentioned issues should be resolved when using the most current package now, it was fixed in the repo for some time. Let me know if there are still issues.

codekoenig avatar Aug 11 '20 22:08 codekoenig