Postgis repository crashes
It happened several times to get a crash when opening a postgis database (click on the black arrow). Layers begin to be listed and at one point, crash occurs. It might be easy to reproduce it happens to me one in two or three.
I've been trying to debug this issue all morning. In debug-mode I hardly ever get the error but when I try in release-mode I get it almost all the time.
In debug-mode I've added a lot of debug logging, letting me believe it might have something to do with timing.
When I disable all logging in debug-mode I also get the error everytime.
Reading a bit more about the SynchronizationContext which is used to get the layers and add them to the treeview I read two commands are available Post and Send.
Currently Post is used which means
You don't wait the Post, you only hopes that it will deliver your message
When I change this Post into Send in MW5.Data.Repository.DatabaseItem.AddLayerNode() the layers don't appear one by one anymore in the treeview but all at once at the end. But more important I don't get the crash anymore.
I'll commit my changes and this needs to be tested.
To be more precise :
It happens when opening repository (black arrow), only when it is loaded (add new connection or start and open an existing connection)
JIT debugger returns "Unhandled exception at 0x741546a9 (msvcr120.dll) in MapWindow.exe: 0xC0000409: 0xc0000409."
And stops there
#if defined (_CRT_APP) || defined (_M_ARM)
#else /* defined (_CRT_APP) || defined (_M_ARM) */
/* Raise a failfast exception and terminate the process */
#endif /* defined (_CRT_APP) || defined (_M_ARM) */