Man this was a while ago!
I got an fix in the form aof a function from the great Tony T.
Here it is:
Imports System.Runtime.CompilerServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports System.Reflection
Public Module PlatformCompatibilityExtensionMethods
Sub New()
Dim types1 As Type() = Nothing
Dim types2 As Type() = Nothing
If (IntPtr.Size > 4) Then
types1 = New Type() {GetType(Entity), GetType(Intersect), GetType(Point3dCollection), GetType(Long), GetType(Long)}
types2 = New Type() {GetType(Entity), GetType(Intersect), GetType(Plane), GetType(Point3dCollection), GetType(Long), GetType(Long)}
Else
types1 = New Type() {GetType(Entity), GetType(Intersect), GetType(Point3dCollection), GetType(Integer), GetType(Integer)}
types2 = New Type() {GetType(Entity), GetType(Intersect), GetType(Plane), GetType(Point3dCollection), GetType(Integer), GetType(Integer)}
End If
PlatformCompatibilityExtensionMethods.intersectWithMethod1 = GetType(Entity).GetMethod("IntersectWith", (BindingFlags.Public Or BindingFlags.Instance), Nothing, types1, Nothing)
PlatformCompatibilityExtensionMethods.intersectWithMethod2 = GetType(Entity).GetMethod("IntersectWith", (BindingFlags.Public Or BindingFlags.Instance), Nothing, types2, Nothing)
End Sub
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal points As Point3dCollection) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, points, CLng(0), CLng(0)}
Else
args = New Object() {other, intersectType, points, CInt(0), CInt(0)}
End If
PlatformCompatibilityExtensionMethods.intersectWithMethod1.Invoke(entity, args)
Return (points.Count - start)
End Function
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal plane As Plane, ByVal points As Point3dCollection) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, plane, points, CLng(0), CLng(0)}
Else
args = New Object() {other, intersectType, plane, points, CInt(0), CInt(0)}
End If
PlatformCompatibilityExtensionMethods.intersectWithMethod2.Invoke(entity, args)
Return (points.Count - start)
End Function
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal points As Point3dCollection, ByVal thisGsMarker As IntPtr, ByVal otherGsMarker As IntPtr) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, points, thisGsMarker.ToInt64, otherGsMarker.ToInt64}
Else
args = New Object() {other, intersectType, points, thisGsMarker.ToInt32, otherGsMarker.ToInt32}
End If
PlatformCompatibilityExtensionMethods.intersectWithMethod1.Invoke(entity, args)
Return (points.Count - start)
End Function
Public Function IntersectWith(ByVal entity As Entity, ByVal other As Entity, ByVal intersectType As Intersect, ByVal plane As Plane, ByVal points As Point3dCollection, ByVal thisGsMarker As IntPtr, ByVal otherGsMarker As IntPtr) As Integer
Dim start As Integer = points.Count
Dim args As Object() = Nothing
If (IntPtr.Size > 4) Then
args = New Object() {other, intersectType, plane, points, thisGsMarker.ToInt64, otherGsMarker.ToInt64}
Else
args = New Object() {other, intersectType, plane, points, thisGsMarker.ToInt32, otherGsMarker.ToInt32}
End If
PlatformCompatibilityExtensionMethods.intersectWithMethod2.Invoke(entity, args)
Return (points.Count - start)
End Function
Private intersectWithMethod1 As MethodInfo = Nothing
Private intersectWithMethod2 As MethodInfo = Nothing
End Module