-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'. #6914
Comments
You are referencing 1.0.1 of Microsoft.EntityFrameworkCore.Design:
This package needs to match the version of the runtime you are using (1.1.0-preview1-final) |
Closing, but feel free to reply if the above comment does not resolve your issue and we will reopen. |
I didn't want to open another issue since my description is the same as this one. I just updated to 1.1 and I'm getting an exception on any db access. I'm using the SapientGuardian provider but I'm not sure if this is an issue with EF or with the provider. The exception I get is: "Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'." This occurs doing a simple lookup like this:
Here is my project.json file. `{
"buildOptions": { "runtimeOptions": { "publishOptions": { "scripts": { |
Sounds like the provider needs to recompile on 1.1. We tested the most common providers to ensure compatibility with 1.1 (Npgsql, SQL Server, SQLite, and MySQL) but we didn't test every provider. Reopening to discuss in triage if this is a change we want to roll back or not. |
Thank you for replying/reopening. For what it is worth, I tried to use the official MySQL provider originally but couldn't even get started. It seems as though their provider does not currently implement the functions necessary to allow the code-first migration functionality to work (running the migration script fails). Bug here: http://bugs.mysql.com/bug.php?id=82981 That is what led me to SapientGuardian to at least get something working. Honestly I would be happy to use anything that works at this point. For now I have reverted back to EF 1.0.1 so I can continue my dev, but I'd love to try 1.1 when there is some movement on this issue. |
We will revert this breaking change, even though it is on an internal type. |
@jeffbromberger this means the SapientGuardian provider should work with the RTM of 1.1.0 |
Issue #6914 Method is not an extension method and is obsolete but should allow code already bound it to continue working.
Thanks for the heads up. Is it practical to build an EF provider that doesn't rely on the internal namespaces at this point? It looks like the Npgsql provider references them too, though perhaps not the parts that triggered this break. Rebuilding against new libraries is easy enough, but eliminating the references to the internals seems like a fair bit of work. cc @how02 |
@SapientGuardian Could you let us know which internal APIs you are using? Last time I checked, npgsql was only using the following:
/cc @roji |
BTW our goal is that folks don't have to use internals... but that isn't reality yet. If a provider needs an API, our goal is to tidy it up and make it public. |
@SapientGuardian How is MySQLCommandBatchPreparer used? (Which uses MySQLValueBufferFactoryFactory.) It seems like this is dead code unless I am missing something. |
I was wondering that myself. I thought it might be something pulled in externally by convention/reflection/magic, but it might just be dead. @how02 that code came in on one of your commits, can you solve the mystery? |
@SapientGuardian Indeed it's dead code, it can be removed. |
Excellent. I've removed the dead code from our repo, and updated my post above. |
@ajcvickers aren't there any more reversions we want to want to do in 1.1? (not sure if this was closed automatically when you pushed your change). |
@divega I made a reference to this discussion in #6716. We decided not to make changes just because providers use internal code. We also did verification with a set of providers that was agreed upon. If we want to do additional checks to see if this or other providers are broken, then that should probably be a new issue that we discuss in triage. |
Here is some additional information from pushing the SapientGuardian provider through NGen (similar to #6783):
The cause is that we removed the parameterless constructors from string method translators in 5e1c562. Reactivating so that we can decide in triage whether we want to fix this for the same reason we reverted the removal of |
Decided to instead open an new issue (#6926) and keep this one closed. |
@ajcvickers will hunt and try to remove Internal usage on my side (npgsql/efcore.pg#122). FYI RelationalModelValidator is not longer used in my 1.1.0 branch. |
Issue #6914 Method is not an extension method and is obsolete but should allow code already bound it to continue working.
Thanks for this. |
Hi. I have read #6865, #6855, and https://blogs.msdn.microsoft.com/dotnet/2016/10/25/announcing-entity-framework-core-1-1-preview-1/ from the release.
I am trying to run
Scaffold-DbContext "Server=(A);Database=B;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Verbose
I am getting the error Method Not Found as per the title (full error at the bottom). To try and resolve this I have
I have read that I may need to delete the Entity Framework directory under %USERPROFILE%/.nuget ... but that seems a bit drastic.
Below is my project.json ... I think I a missing something small and would appreciate any pointers to help through this. I did try rolling back to preview2-final on tools but it all seems to have gone a bit wrong.
`{
"dependencies": {
"Microsoft.AspNetCore.Authentication": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authorization": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Identity": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0-preview1-final",
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
}
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
`
and here is the full error message ...
System.MissingMethodException: Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'. at Microsoft.EntityFrameworkCore.Scaffolding.Internal.StringBuilderCodeWriter.WriteCodeAsync(ModelConfiguration modelConfiguration, String outputPath, String dbContextClassName, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration configuration, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable
1 schemas, IEnumerable1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<ScaffoldContextImpl>d__22.MoveNext() at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable
1 source, Int32& length)at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable
1 source) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0
1.b__0()at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)`
The text was updated successfully, but these errors were encountered: