Could not load type 'Microsoft.EntityFrameworkCore.Metadata.Internal.AdHocMapper'

Misha Kurytsia 0 Reputation points
2025-02-18T09:23:05.2533333+00:00

I'm using .NET 8.0, Entity FrameworkCore 9.0.2, MySql.EntityFrameworkCore 9.0.0 and when I try to get data from the database I get the following error.

How to resolve this problem?

System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Metadata.Internal.AdHocMapper' from assembly 'Microsoft.EntityFrameworkCore, Version=9.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Developer technologies .NET Entity Framework Core
Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET Other
{count} votes

1 answer

Sort by: Most helpful
  1. chand thiru 0 Reputation points
    2025-03-16T15:26:39.54+00:00

    Hi @Misha Kurytsia, not sure if you found the answer, I was getting the same error with 9.0.3. I followed article https://github.com/dotnet/efcore/issues/35179 and switched back to 8.0.11 for EF and MySQL.EF packages and got past the error.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.