The add-in was initally wrote without using backgroundworker and it worked fine. I was able to create a shapefile which can be added and viewed immediately after the execution in the same ArcMap session.
Then I tried to add a progress bar to the UI which was not showing any change until the execution was complete. That's when I added a backgroundworker class and moved the time-consuming shapefile creation code (without any change) into the dowork event handler of the backgroundworker.
While this makes the UI much more responsive, if I add the result shapefile into the same ArcMap session, nothing shows up on the screen. ArcMap also reports a Drawing Error, saying "Cannot acquire a lock [the table xxx is being written by another process].
I'm sure the writing is complete at that point. And I can view the result without any problem if I close the current ArcMap session and start a new one.
There is too much code to post and I have a strong feeling the problem is caused by moving the code as is to the backgroundworker class. I hope you folks out there who's more experienced with backgroundworker/ArcGIS add-in can give me some pointers what could be the culprit. Thanks in advance!