ThinkGeo.com    |     Documentation    |     Premium Support

New projection exception

Dear Support,


I'm now experiencing a new exception with 3.0.392 when I remove layers


Overlay.lock.enterwritelock()

overlay.Layers.clear ();

Overlay.lock.exitwritelock();

map.refresh();


if one or more of the layers used a projection, then I often get:


L'exception System.Reflection.TargetInvocationException n'a pas été gérée

  Message="Une exception a été levée par la cible d'un appel."

  Source="mscorlib"

  StackTrace:

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

       à System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

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

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

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

       à ThinkGeo.MapSuite.Core.Proj4Projection.xebc36fa7da52d8d7(IntPtr x4fa9e7eeb5ea7ffa)

       à ThinkGeo.MapSuite.Core.Proj4Projection.CloseCore()

       à ThinkGeo.MapSuite.Core.Projection.Close()

       à ThinkGeo.MapSuite.Core.Proj4Projection.x0f09c3fcb8980efd(Boolean x8d14c6905e5eb7a3)

       à ThinkGeo.MapSuite.Core.Proj4Projection.Finalize()

  InnerException: System.AccessViolationException

       Message="Tentative de lecture ou d'écriture de mémoire protégée. Cela indique souvent qu'une autre mémoire est endommagée."

       Source="Proj4ExtensionX86"

       StackTrace:

            à Proj4Extension.Proj4Extensionx86.pj_free(IntPtr projPJ)

            à Proj4Extension.Proj4Extensionx86.Free(IntPtr projPJ)

       InnerException:



Patrick,


Thanks for your reporting! Unfortunately, I encountered a different problem with version 3.0.392. My problem is after I clear the layers, it won’t refresh the Map control until it was on painted and this problem has been fixed in later versions (3.0.409 or later). While I did not see the exception you described.
 
Can you try the sample in attachment to see how is going on; hopefully we are on the same line.
 
Please feel free let me know if any more questions!
 
Thanks.
 
Yale

1149-Post6245_Sample.zip (11.5 KB)

Yale, 
  
 with your sample & 392, I can reproduce your issue (no refresh). 
 to reproduce mine, I simply need to add a loop to your sample to add not 2 but 200 layers. 
  
 Can I have 3.0.409 today? 
 Patrick.

Patrick, 
  
 Thanks for letting us know your status! 
  
 You can contact our support for version 3.0.409. 
  
 So you added 200 layers and then the exception will happen when call the clear? 
  
 Please feel free let me know if any more questions! 
  
 Thanks. 
  
 Yale 


yes simply add a look to add 200 projected layers and it crashed. 
  
 What do you mean by "you can contact support for 409" ? 
 I used to requesting a special build in that forum, did the procedure changed, can you explain ? 
  
 Patrick.

No problem, I will contact our support and ask him to send you the temporary build (3.0.409) package as soon as possible:). 
  
 Besides, I will do more investigations on your exception by adding more layers. 
  
 Please feel free let me know if any more questions! 
  
 Thanks. 
  
 Yale 


Patrick, 



I have contacted our support to send you the latest version (3.0.410), compare to 3.0.409 , one bug fixed was included. 





Please feel free let me know if any more questions! 



Thanks. 



Yale 

 



Yale, 
  
 This still occurs in 3.0.410; making my product unstable and it’s show stopper for us. 
  
 Regards, 
 Patrick.

Patrick,


I am sorry to say that I still cannot recreate the problem you talked about. Attached contains a demo showing clear layers in a overlay with more than 200 layers(projection set for each Layer).
 
And when click the clear button, it seems works fine.
 
Let me know if I make any mistake to reproduce your problem.
 
Thanks.
 
Yale

1159-Post6245_Sample_Update.zip (11.3 KB)

Yale,


Here is a very simple sample that reproduce the exception.


Please note that the exception occurs in "release x86" mode in that sample.


Hope you'll help me.


Patrick.



1160-Post6239.zip (11.8 KB)

Patrick, 
  
   I was able to see the exception.  It only happens under X86 and does not happen under Any CPU (On 64 bit machine), or X64.  The exception is happening inside of the Proj4 library which is a third part library and in C which is a bummer.  I played with the layer amount and found that 31 was the magic number of layers to make it fail.  I may be way off but I suspect it has to do with an internal C pointer or place in memory that is assigned to track the instances of the Proj4 library in memory and they are using 4 bytes which would be 32 bits, or an integer sized area.  When we go over that we get the exception.   This would possibly explain the issue not happening in the 64 bit environment with any CPU. 
  
   The good news is that we are releasing the next version on Monday where you can used shared projections much more easily between your layers so you should not need to create a bunch of projections.  The bad news is that the Proj4 library is pretty complex and is in C which never helps and we do not have the resources to research this this for a few days at least.  We rely on the third party library being pretty well used but maybe they did not consider it being used with so many instances. 
  
 On another note I modified your sample to close and re-open all of the layers when you click the ‘change projection’ button and it worked just fine.  This was related to another post you had that I saw.  In that way I think you can also share the projection without any problem without even worrying about that error that the projection is not open. 
  
 David