question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This method does not support GeometryCollection arguments?

See original GitHub issue

So we’re using Asp.Net Core 2.1.1 + EF Core +npgsql.efcore.pgsql.nettopologysuite for our web api.

One of my model contains a Point property. It’s getting serialized correctly, but if I post what I’m getting back to our web api, i’m always getting the exception saying “This method does not support GeometryCollection arguments”. It seems like there is a problem in the deserialization, but I have no clue what could be wrong.

Can someone help me with this problem?

   at NetTopologySuite.Geometries.Geometry.CheckNotGeometryCollection(IGeometry g) in C:\TeamCity\BuildAgent\work\9f3b4b5334e77626\NetTopologySuite\Geometries\Geometry.cs:line 2057
   at NetTopologySuite.Geometries.GeometryCollection.get_Boundary() in C:\TeamCity\BuildAgent\work\9f3b4b5334e77626\NetTopologySuite\Geometries\GeometryCollection.cs:line 233
   at Microsoft.Extensions.Internal.PropertyHelper.CallNullSafePropertyGetter[TDeclaringType,TValue](Func`2 getter, Object target)
   at Microsoft.AspNetCore.Mvc.Internal.DefaultComplexObjectValidationStrategy.Enumerator.GetModel(Object container, ModelMetadata property)
   at Microsoft.AspNetCore.Mvc.Internal.DefaultComplexObjectValidationStrategy.Enumerator.<>c__DisplayClass10_0.<MoveNext>b__1()
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationEntry.get_Model()
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitChildren(IValidationStrategy strategy)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitComplexType(IValidationStrategy defaultStrategy)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Visit(ModelMetadata metadata, String key, Object model)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitChildren(IValidationStrategy strategy)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitComplexType(IValidationStrategy defaultStrategy)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Visit(ModelMetadata metadata, String key, Object model)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitChildren(IValidationStrategy strategy)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.VisitComplexType(IValidationStrategy defaultStrategy)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Visit(ModelMetadata metadata, String key, Object model)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationVisitor.Validate(ModelMetadata metadata, String key, Object model, Boolean alwaysValidateAtTopLevel)
   at Microsoft.AspNetCore.Mvc.ModelBinding.ObjectModelValidator.Validate(ActionContext actionContext, ValidationStateDictionary validationState, String prefix, Object model, ModelMetadata metadata)
   at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.EnforceBindRequiredAndValidate(ObjectModelValidator baseObjectValidator, ActionContext actionContext, ParameterDescriptor parameter, ModelMetadata metadata, ModelBindingContext modelBindingContext, ModelBindingResult modelBindingResult)
   at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
iamkineticcommented, Aug 15, 2018

Ok, I got it working. In my Startup.ConfigureServices, I added a bit of code to suppress the Point type validation:

var validator = new SuppressChildValidationMetadataProvider(typeof(Point));
services.AddMvc(options => options.ModelMetadataDetailsProviders.Add(validator));

It seems like the deserialization itself was working correctly, it’s the Asp.Net Core validation of the deserialized object that was failing.

0reactions
rojicommented, Aug 11, 2018

See also https://github.com/npgsql/npgsql/issues/1981 for other issues regarding direct JSON serialization of NTS spatial types.

Read more comments on GitHub >

github_iconTop Results From Across the Web

This method does not support GeometryCollection arguments
Hi I am using .net core 2.2 and i have a very strange problem using a IGeometry field I have the following class...
Read more >
Trying to serialize JTS point - This method does not support ...
I'm trying to use the JTS library and I'm having a strange problem with serializing a class that has a Point property. import...
Read more >
Does not support geometrycollection arguments
Getting this error message when trying to start a new navigation; Routing server error: this method does not support geometrycollection ...
Read more >
[Geoserver-users] Error on update a MultiGeometry ...
java:450) Caused by: java.lang.IllegalArgumentException: This method does not support GeometryCollection arguments at com.vividsolutions.jts.geom.Geometry.
Read more >
Re: [Jts-topo-suite-user] side location conflict
Unary Union = Geometry#union() (which is the method you're using in the second ... This method > does not support GeometryCollection arguments >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found