Skip to content
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

NTS scaffolding still reports "Could not find method 'UseNetTopologySuite' " in v6.0.0 #2133

Closed
GISerWYJ opened this issue Dec 1, 2021 · 2 comments · Fixed by #1997
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@GISerWYJ
Copy link

GISerWYJ commented Dec 1, 2021

NTS scaffolding still reports "Could not find method 'UseNetTopologySuite' " in v6.0.0. is this due to #1997 not merged to main?

@alibarut
Copy link

alibarut commented Dec 22, 2021

i get same issue when create db model with "dotnet ef dbcontext scaffold" command. All referanced libraries version 6.0.1


System.TypeInitializationException: The type initializer for 'Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.Scaffolding.Internal.NpgsqlNetTopologySuiteCodeGeneratorPlugin' threw an exception.
 ---> System.InvalidOperationException: Could not find method 'UseNetTopologySuite' on type 'Microsoft.EntityFrameworkCore.NpgsqlNetTopologySuiteDbContextOptionsBuilderExtensions'
   at System.SharedTypeExtensions.GetRequiredRuntimeMethod(Type type, String name, Type[] parameters)
   at Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.Scaffolding.Internal.NpgsqlNetTopologySuiteCodeGeneratorPlugin..cctor()
   --- End of inner exception stack trace ---
   at Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.Scaffolding.Internal.NpgsqlNetTopologySuiteCodeGeneratorPlugin.GenerateProviderOptions()
   at Microsoft.EntityFrameworkCore.Scaffolding.ProviderCodeGenerator.GenerateProviderOptions()
   at Microsoft.EntityFrameworkCore.Scaffolding.IProviderConfigurationCodeGenerator.GenerateUseProvider(String connectionString)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.GenerateOnConfiguring(String connectionString, Boolean suppressConnectionStringWarning)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.GenerateClass(IModel model, String contextName, String connectionString, Boolean suppressConnectionStringWarning, Boolean suppressOnConfiguring)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpDbContextGenerator.WriteCode(IModel model, String contextName, String connectionString, String contextNamespace, String modelNamespace, Boolean useDataAnnotations, Boolean useNullableReferenceTypes, Boolean suppressConnectionStringWarning, Boolean suppressOnConfiguring)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.CSharpModelGenerator.GenerateModel(IModel model, ModelCodeGenerationOptions options)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluarlize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
The type initializer for 'Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite.Scaffolding.Internal.NpgsqlNetTopologySuiteCodeGeneratorPlugin' threw an exception.
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite" Version="6.0.1" />

@roji roji self-assigned this Dec 22, 2021
@roji roji added the bug Something isn't working label Dec 22, 2021
@roji roji added this to the 6.0.2 milestone Dec 22, 2021
@roji
Copy link
Member

roji commented Dec 22, 2021

Yeah, my bad - #1997 should have been merged for 6.0.0. I merged it for 6.0.2.

@roji roji linked a pull request Dec 22, 2021 that will close this issue
@roji roji closed this as completed Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants