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 4109092
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:44:56+00:00 2026-05-20T21:44:56+00:00

I have a WCF Service (several, actually) called by a WPF application, all under

  • 0

I have a WCF Service (several, actually) called by a WPF application, all under .NET 4.0. Using the QuickBooks Integrator 5.0 from nsoftware (a .NET wrapper library for the QuickBooks SDK), most of my routines work fine. However, when some of them are run from a new thread, AND there’s an error, particularly one where the QuickBooks file can’t be opened, then I get a wide variety of strange errors, including an SEHException, both an “invalid arg status util” and a “procedure entry point not found” in QBUtilities.dll, and an access exception violation.

For example, the routine when called directly from the client, works as expected. Let’s say I deliberately load the wrong QuickBooks file (meaning QuickBooks cannot open the file my application is expecting; a fatal trappable error) and call it:

GetCustomerWithQB(int CustID)
{
 .. set up code
 ..
 try {
   ..
   ..
   toReturn.QBCustomer.QBCustomer.Get(QuickBooksId); // this goes to QB to do the fetch
 }
 catch (nsoftware.InQB.InQBException x)
 { 
   // we get, correctly, a 602 "there is a different file open" error.
 }
} 

However, if I call that routine from within the service, spawning a new thread:

Task.Factory.StartNew(delegate { GetCustomerWithQB(CustID); });

Then I get the variety of errors above. GRRRR. Help?

  • 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-05-20T21:44:56+00:00Added an answer on May 20, 2026 at 9:44 pm

    After extensive debugging and a day’s worth of research, it turns out that I only got the weird errors when I had TWO routines calling at once. This led me to investigate a number of avenues, the most useful of which was this question. Bottom line, I created a static single-threaded StaTaskScheduler (from the Microsoft’s Parallel Extensions library):

    _staSchedulerForQBCalls = new StaTaskScheduler(numberOfThreads:1);
    

    and used it for all the tasks calling QuickBooks:

    Task.Factory.StartNew(delegate { GetCustomerWithQB(CustID); }, CancellationToken.None, TaskCreationOptions.None, _staSchedulerForQBCalls);
    

    As these things usually do, it seems reasonably obvious in hindsight, but the bizarre errors and limited circumstances of problems certainly didn’t point me in this direction at first.

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

Sidebar

Related Questions

I have a WCF service sitting in the cloud. And my application makes several
.NET 3.5, VS2008, WCF service using BasicHttpBinding I have a WCF service hosted in
We have a WCF (Windows Communication Foundation) client and service application. We're using Windows
I have a WCF service (not RIA) that I access from Silverlight. The application
I have several wcf services which are hosted using ServiceHost class. Now , I
I have a WCF service that I need to call in a ASP.NET web
I have a WCF Service Using MSMQ hosted on IIS. I want to create
I have a WCF service that needs to hosted using basicHttpBinding using SSL. So
I have a WCF Service that maintains several connections to various databases. I am
I have a WCF web service that exposes several business methods. I also have

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.