Closed mcmikecreations closed 1 year ago
If you're getting that exception, we've tried lots of different conversion methods, including direct casts, IConvertible, looking for implicit and explicit conversion operators, constructors on the target type.
Can you post the exception and stack trace? It's not clear to me exactly what conversion it's attempting.
Or better yet, submit a PR with a failing test case so we can just debug an fix.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug
I encountered this issue while trying to work with PostGIS
Point
. If a class is defined with a field or property of typePoint
and postgres returnsGeometry
of typePoint
, the conversion here can't perform the cast and an exception is thrown.If I replace the property type with
Geometry
everything works. If I then domyObject.Geom.GetType()
it returnsPoint
instead ofGeometry
, so the deserializer works correctly, but the IL generation fails to create a cast. An ideal solution would be to generate IL code that tries to perform a cast if thetargetType
is a child of thesourceType
inEmitConversion
.Steps to reproduce
Expected behavior
I expect to have an auto-conversion between Geometry and Point/Polygon/etc. but this also applies to other similar cases.