ThinkGeo.com    |     Documentation    |     Premium Support

Target of Invocation error

I am having a multi-threaded related issue that was not present with the previous version of MapSuite. I myself am not using multi-threading so the issue is bubbling from the Map Suite component. The issue is specific to my application and not my data and I can not recreate the issue using a simpler and smaller syntax.


I can not post the code as it is relatively large nor can I send you my project. Is there any way a GoToMeeting can be arranged for a demonstration of the error? Placing the component in singlethreaded mode seems to make no difference at all. The erroring routine occurs during the map draw. It is highly complicated to explain....


 


 


 


 



Nelson, 
  
 Please contact your sale representive who can arrange the go-to-meeting for you I think. 
  
 Thanks, 
  
 Ben

Hi there,


I'm experiencing the same issue and found a workaroud.


VS designer automatically add this code to the map initializer



 


 


this.mapVignette.CurrentScale = xx.yyy;


This causes MS to crash if you do not load any layer to the map but call map.refresh (). 


Simply delete that line from main.designer.cs solves the issue... I did not found yet how to avoid this line being recreated by VS.


Hope this helps.


Patrick.


 



Hi,


I also got the TargetInvocationException in Multi-Threaded mode. I have lots of data in PostgreSQL database, I wanted to retrieve a subset of it to create a postgreFeatureLayer, after a while, no response, I retrieved again, then I got the error, following is the stacktrace:


System.Reflection.TargetInvocationException was unhandled

  Message="Exception has been thrown by the target of an invocation."

  Source="mscorlib"

  StackTrace:

       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

       at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

       at ThinkGeo.MapSuite.Core.Proj4Projection.x95c4ca6342aad2f1(IntPtr xce536087faba9488, IntPtr x6d3e0b22c9356db3, Int64 x971ce686c8b74ac9, Double[] x31d531fc882737ba, Double[] x272f87fcdd19be88, Double[] xb5f5ca13f19c3e64)

       at ThinkGeo.MapSuite.Core.Proj4Projection.ConvertToExternalProjectionCore(Double[] x, Double[] y)

       at ThinkGeo.MapSuite.Core.Projection.xfcfa8cfe0cd69ed5(Byte[] x61ddc1291c0e3204)

       at ThinkGeo.MapSuite.Core.Projection.x479147ab5a3dca02(Byte[] x61ddc1291c0e3204)

       at ThinkGeo.MapSuite.Core.Projection.ConvertToExternalProjection(Feature feature)

       at ThinkGeo.MapSuite.Core.FeatureSource.ConvertToExternalProjection(Feature feature)

       at ThinkGeo.MapSuite.Core.FeatureSource.ConvertToExternalProjection(IEnumerable`1 features)

       at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesForDrawing(RectangleShape boundingBox, Double screenWidth, Double screenHeight, IEnumerable`1 returningColumnNames)

       at ThinkGeo.MapSuite.Core.FeatureLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)

       at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)

       at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)

       at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x27d0591c2adda8d9(RectangleShape xb35a33b423b17f65, Overlay x99251f66cdabc2ad, Int32 xa209325f5c895f7e, Int32 x7454a0d1965919b1, GeographyUnit xbb704b4400ce6f76)

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x27d0591c2adda8d9(Object x9c95f4613bdc3113)

       at System.Threading.ExecutionContext.runTryCode(Object userData)

       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)

       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

  InnerException: System.AccessViolationException

       Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

       Source="Proj4ExtensionX64"

       StackTrace:

            at pj_transform(Void* , Void* , Int32 , Int32 , Double* , Double* , Double* )

            at Proj4Extension.Proj4ExtensionX64.Transform(IntPtr srcCs, IntPtr destCs, Int32 pointCount, Double[] x, Double[] y, Double[] z)

       InnerException: 

 



Just to clarify, the issue I am having happens in Single or Multi-threaded mode. Actually, most of them seem to be.

Thanks for your sharing, Patrick. 
  
 But I tested again with the latest build (3.0.307 RC1) , just drag a winform MapControl and in the Form_Load , call refresh, it will not crash. 
  
 Rose, we still cannot reproduce your problem in our test sample codes, I am not sure other problems in another posts will resolve this;  
 We will continue try to recreate this problem and solve it. It would be very helpful and appreciate if you can give us some hints to recreate it.  And if this problem still exits, I think if possible, you can send us some code snippet to recreate it.   Any clue would be appreciated. 
  
 Yale. 


In my scenario, I am not calling any refresh before layers have been added. I have a hard time replicating the error in a new project as mine is kind of complex but I tried to use highly similar syntax. I have requested a GoToMeeting and am awaiting a time on that. If anything substantive comes from that I’ll be sure to post my circustance up.

Nelson, 
  
 Hope we can move forward, I think we will arrange the go-to-meeting soon to see what the problem is. 
  
 Sorry for all the inconvenience. 
  
 Thanks. 
 Yale.