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

  • SEARCH
  • Home
  • 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 7789481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:18:43+00:00 2026-06-01T21:18:43+00:00

WPF, Excel AddIn, C#, I have multiple asychronous calls to get data from web

  • 0

WPF, Excel AddIn, C#,
I have multiple asychronous calls to get data from web service on main thread, then in call back,
I will plot the data in Excel. I tracked call back and they run on main thread, too.
but I still get COMException 0x800AC472, googled and it seems this is a multi-thread issue.

but I am confused why this happened.
I think there is only one main thread and since all callback are run on main thread and there is no reason to have the exception?

Edit:
On main UI thread, ribbon/button is clicked, it will call web service BuildMetaData,
once it is returned back, in its callback MetaDataCompleteCallback, another web service call is sent
Once it is returned back, in its callback DataRequestJobFinished, it will call plot to plot data on Excel. see below

On Main UI class:
Btn_Click()
{
...
                       _reportObjs[index].GenerateReport();

}

on Class to GenerateReport

public void GenerateReport()
{
                Request.ParseFunction();
                Request.MetacompleteCallBack = MetaDataCompleteCallback;
                Request.BuildMetaData();
}

public void MetaDataCompleteCallback(int id)
{
            try
            {
                if (Request.IsRequestCancelled)
                {
                    Request.FormulaCell.Dispose();
                    return;
                }

                ErrorMessage = Request.ErrorMessage;
                if (string.IsNullOrEmpty(Request.ErrorMessage))
                {
                    _queryJob = new DataQueryJob(UnityContainer, Request.BuildQueryString(), DataRequestJobFinished, Request);
                }
                else
                {
                    ModifyCommentOnFormulaCellPublishRefreshEvent();
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                ModifyCommentOnFormulaCellPublishRefreshEvent();
            }
            finally
            {
                Request.MetacompleteCallBack = null;
            }
} 


        public void DataRequestJobFinished(DataRequestResponse response)
        {
            Dispatcher.Invoke(new Action<DataRequestResponse>(DataRequestJobFinishedUI), response);
        }

        public void DataRequestJobFinished(DataRequestResponse response)
        {
            try
            {
                if (Request.IsRequestCancelled)
                {
                    return;
                }

                if (response.status != Status.COMPLETE)
                {
                    ErrorMessage = ManipulateStatusMsg(response);
                }
                else // COMPLETE
                {
                    // TODO: Convert this into factory pattern
                    var tmpReq = Request as DataRequest;
                    if (tmpReq == null) return;

                    new VerticalTemplate(tmpReq, response, IsOffice2003).Plot();

                }
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
                MIMICShared.Helper.LogError(e);
            }
            finally
            {
                //if (token != null)
                //    this.UnityContainer.Resolve<IEventAggregator>().GetEvent<DataQueryJobComplete>().Unsubscribe(token);
                ModifyCommentOnFormulaCellPublishRefreshEvent();
                Request.FormulaCell.Dispose();
            }
        }


        on plot class

        public void Plot()
        {
        ... 
           attributeRange.Value2 = headerArray;
           DataRange.Value2 = ....
           DataRange.NumberFormat = ... 
        }
  • 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-01T21:18:45+00:00Added an answer on June 1, 2026 at 9:18 pm

    I saw this stackoverflow.com/questions/5246288/errormessage-in-excel, social.msdn.microsoft.com/forums/en-US/vsto/thread/… It seems there is no solution to the issue except wait/retry.
    THis post talks about how to check if Excel is in edit. http://www.add-in-express.com/creating-addins-blog/2011/03/23/excel-check-user-edit-cell/

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

Sidebar

Related Questions

I have a web application...where I can get an excel file from network drive...using
In my WPF app I have a data import function which imports data from
I have WPF DataGrid (VS2010 C#). I copied the data from DataGrid to Clipboard
I have a strange bug with WPF Interop and an Excel Addin. I'm using
I have a C# WPF application which uses Excel interop libraries to generate and
I have a DevExpress WPF grid (version 9.3). When I export to excel, it
I'm using DevExpress Wpf GridControl v2011.2. I try to export data to excel via
I have a C# WPF (.NET 4.0) application that uses Excel interop to read
I have a WPF-mvvm application. I need to read an excel file..and create a
I'm using the datagrid from the WPF Toolkit for 3.5. I have a need

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.