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!
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.
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 ?
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.
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.