1.15.2004

Score! I fixed my bug from yesterday and last night! Thank god for .NET's Control.Invoke() method.

For all ye geeks out there, what was happening was that an ESRI IMapControl2 of mine wasn't refreshing like i'd expect it to, and sometimes the thing would just totally hose out and crash the application when I tried refreshing it. The refreshing happens, though, in response to an event being fired from a class in a different DLL. The problem just reeked of a thread issue... thought maybe the event was being handled in a different thread than the main application, and the mapcontrol didn't like being refreshed from this different thread. Well, Control.Invoke() to the rescue! That method lets you invoke a method from the control's thread instead of the current context. Thus, it lets a person jump thread boundaries, and makes everyone happy.

I just love telling the world when I solve problems. :)

No comments: