Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8631469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:13:25+00:00 2026-06-12T09:13:25+00:00

The add-in was initally wrote without using backgroundworker and it worked fine. I was

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:13:25+00:00Added an answer on June 12, 2026 at 9:13 am

    I resolved the issue, however, not quite sure why it is the case.

    The backgroundworkder_DoWork() calls a function that uses a FeatureCursor in the way below:

    IFeatureCursor featureCursor = FeatureClass.Update(null,true);

    go through the features doing updates with the cursor

    if (certain condition)
    {
    featureCursor=FeatureClass.Update(null,true);
    go through the features again doing some additional updates
    }

    I found out that even if I run the Marshal.ReleaseComObject() method on featureCursor in the end, the write lock (“.wr.lock”) to the shapefile persists. However, if instead of re-using featureCursor I define and use a new cursor in the “if” clause, Marshal.ReleaseCombObject() method can remove the write lock. But then again, if a new cursor is defined and used, I don’t need to use the release method. Although the “.wr.lock” file remains after the execution, I can add the output shapefile to the same ArcMap session and view it without any problem.

    Would appreciate it if someone can give insight on why the above code as is when placed in the UI thread didn’t cause any issue, but when called by the backgroundworker_DoWork() runs into the lock issue.

    And also is it a bad habit to re-use a FeatureCcursor as I did in the code above?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Initially i wanted to add trailing / in my url (lighttpd) which is possible
Please add an SSH key before provisioning a machine. I am trying to create
to add clarity to the below. I was considering using timers or storyboard.CurrentTimeInvalidated but
I initially create a table using some data loaded from a php mySQL query.
How can I add a field that contains a rows rank within the result
I need to write a function that can read a file, and add all
I add my url xxx/getjson.php to a webhook and once a person signup, it
The .add method appends components to the end of another component. I'm trying to
I add a EditText into a Linearlayout, for each ,I set a picture as
I add webview and navigationbar inside my view controller . Web view is display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.