NetTopologySuite / NetTopologySuite.IO.SpatiaLite

SpatialLite IO module for NTS.
BSD 3-Clause "New" or "Revised" License
7 stars 9 forks source link

Adding this nuget package causes a runtime error on existing code. #5

Closed ianfoster99 closed 4 years ago

ianfoster99 commented 4 years ago

NetTopologySuite.IO.SpatiaLite/tree/develop/src/NetTopologySuite.IO.GeoPackage

The runtime is caused during the DBContext constructor base(_options) call

    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> _options) : base(_options)
    {
        Database.AutoTransactionsEnabled = true;
    }

If I uninstall the NetTopologySuite.IO.GeoPackage package then the runtime error disappears

Could be my setup but thought I'd reach out to you.

Error is :- System.MissingMethodException: 'Method not found: 'GeoAPI.IGeometryServices NetTopologySuite.NtsGeometryServices.get_Instance()'.'

Heres the packages I'm using in the project :- Ical.Net" Version="4.1.11" Microsoft.AspNetCore.App" Microsoft.AspNetCore.Mvc.TagHelpers" Version="2.2.0" Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="2.2.6" Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" mod_spatialite Version="4.3.0.1" NetTopologySuite.IO.GeoPackage" Version="2.0.0" ** NWebsec.AspNetCore.Core" Version="2.0.0" NWebsec.AspNetCore.Middleware" Version="2.0.0" NWebsec.AspNetCore.Mvc" Version="2.0.0" NWebsec.AspNetCore.Mvc.TagHelpers" Version="2.0.0" PaulMiami.AspNetCore.Mvc.Recaptcha" Version="1.2.1" ProjNET4GeoAPI" Version="1.4.1" Serilog.AspNetCore" Version="3.0.0" Serilog.Sinks.Console" Version="3.1.1" Serilog.Sinks.MSSqlServer" Version="5.1.2" Serilog.Sinks.Trace" Version="2.1.0" SharpKml.Core" Version="5.0.1" SimpleMvcSitemap" Version="3.1.0" Swashbuckle.AspNetCore" Version="4.0.1" Swashbuckle.AspNetCore.Annotations" Version="4.0.1" Swashbuckle.AspNetCore.ReDoc" Version="4.0.1" YamlDotNet" Version="7.0.0"

ianfoster99 commented 4 years ago

Just found out that GeoApi 1.7.5 was auto uninstalled when this package was installed and thats the issue. Is there a work around?

airbreather commented 4 years ago

Version 2.x of the NetTopologySuite packages will only work with version 3.x of the Microsoft.EntityFrameworkCore.*.NetTopologySuite packages.

As of version 2.x, NetTopologySuite no longer uses GeoAPI.

Please see the Upgrading to 2.0 from 1.x page on the NTS wiki for more information that might be useful.

ianfoster99 commented 4 years ago

Really quick reply. Many thanks for the update.

bricelam commented 4 years ago

Related: https://github.com/aspnet/EntityFrameworkCore/issues/18180