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

The Archive Base Latest Questions

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

Here is how the application is designed – I have a COM server raising

  • 0

Here is how the application is designed –
I have a COM server raising events on certain conditions.
I have a C# client UI which is supposed to handle these events raised by this COM server.

There is a delegate in my C# client which I pass to the COM server and it calls back on an event. I have a custom wrapper which marshals the delegate as function pointer. Like so…

     Fxn1inCOMWrapper([In, MarshalAs(UnmanagedType.FunctionPtr)] Client.SetStatusDelegate StatusCallback);

The callback mechanism works.
The problem here is that once I get the callback, I am supposed to call another method in the COM Server to invoke further processing.

I am not able to make the second function call to COM component from the C# callback method, and it corrupts the stack in COM and it returns me an exception.
I am guessing it is the case because the callback is not the same thread on which the COM object was created and the first call was made. Is it possible to work around this problem?

One option was to set a flag in event callback in C# client. And on a timer from the main thread, check for the flag and if yes, make the second call. But there surely has to be a more elegant way of doing this…Can anyone help please?

  • 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:29:16+00:00Added an answer on June 1, 2026 at 9:29 pm

    Try changing the threading attribute on your Main() function. For example, if you have:

    [STAThread]
    static void Main()
    

    change it to:

    [MTAThread]
    static void Main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my situation. I have a server application designed for multiple users to
i m relatively new in Objective C, i have designed a server-client application and
Here is the scenerio: We have an application running on Webphere Portal Server 6.1
Here's a use case: I have a desktop application (built using Eclipse RCP) which
Here's what i'm trying to do. I have a Student Result Application in which
I have a Jsfiddle application here . If you type in a question in
here is a good question: I have an application compiled for iPhone OS 2.21.
I have designed an application that requires no install and can be used by
I have oracle backend for my application. The schema is designed such that I
I have an interesting problem: My application is designed to send and open up

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.