My app. I'm getting this kind of error when I'm upgrading to NETCore6 and EFCore6. What do I have to do to fix it?
System.MissingMethodException:
{"Method not found: '!!0 Thinktecture.RelationalDbContextOptionsBuilderExtensions.AddOrUpdateExtension(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder, System.Action1<!!0>, System.Func
1<!!0>)'."}
using x.Common.Consts;
using x.Common.Helpers;
using x.Core.Helpers.OutputFormatters;
using x.Core.Services;
using x.Core.Services.DomainOrganization;
using x.Core.Services.EmployeeFeature;
using x.Core.Services.Integration.Api.x;
using x.Core.Services.Integration.Api.Teleperformance;
using x.Core.Services.Integration.Api.Turknet;
using x.Core.Services.Interfaces;
using x.Core.Services.Interfaces.Integration.Api.x;
using x.Core.Services.Interfaces.Integration.Api.Teleperformance;
using x.Core.Services.Interfaces.Integration.Api.Turknet;
using x.Core.Services.Interfaces.LDAP;
using x.Core.Services.LDAP;
using x.Domain.DataAccess;
using x.Domain.Infrastructure.DataAccess;
using x.Presentation.Api.IntegrationApi.Helper;
using Elastic.Apm.NetCoreAll;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
using Thinktecture;
services.AddDbContext<XNonSecureContext>(options =>
{
if (bool.Parse(Configuration["AppConfig:UseInMemoryDB"]))
options.UseInMemoryDatabase(new Guid().ToString());
else
{
var connection = HttpHelper.conStrSql;
options.UseSqlServer(connection, sqlServerOptions =>
{
sqlServerOptions.EnableRetryOnFailure();
sqlServerOptions.CommandTimeout(120);
sqlServerOptions.AddTempTableSupport();
});
if (bool.Parse(Configuration["Serilog:LogSQLParameters"]))
options.EnableSensitiveDataLogging(true);
}
});
CodePudding user response:
Your sqlServerOptions.AddTempTableSupport()
appears to be a custom extension method created by your organization. This method calls a method in a Thinktecture assembly, but your application can't find that metho at runtime.
As always with a MissingMethodException this means you're running your application against another assembly than parts of it were compiled against.
Make sure that you use the same version everywhere.
CodePudding user response:
Such errors usually are sign of some nuget version mismatch. Since you have not provided a full .csproj file it is hard to say which ones exactly, but there are several in question, like Microsoft.EntityFrameworkCore.SqlServer
is definitely should be upgraded to 6.x. I would assume that you have some package Thinktecture.Something...
installed also so you need to update those to version which support 6.x version of EF Core (if it is one from pawelgerr then latest 4.2.3 versions seems to be appropriate).