?
Solved

make async method com friendly

Posted on 2015-01-05
6
Medium Priority
?
123 Views
Last Modified: 2015-01-14
i have the following method in my class:
public async Task<int> FetchEventsAsync()

I compile to make class com visible, but get the following error:
 Warning: Type library exporter encountered a generic type instance in a signature. Generic code may not be exported to COM.

how do I make this function non-generic?
0
Comment
Question by:dhenderson12
  • 4
  • 2
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40532556
Async--in this context--is a .NET specific idea. Why do you need this in COM? Why not just expose a synchronous API for COM purposes?
0
 

Author Comment

by:dhenderson12
ID: 40532717
my thinking is that this function raises events that it receives from calling a web api with a 60 second timeout (in the web api itself).  By calling it async it will effectively run in its' own thread without locking up the rest of the web page (it is an embedded object on a web page).
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 40532741
My guess is that you'll have to fall back to regular threading, but hold out for more responses.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:dhenderson12
ID: 40532777
Can you provide any guidance on how to implement regular threading to handle this?  The bottom line is that I need to raise any events available to my web page.  The event handler on the web page will then make another call to fetch any new events after processing the event.  BTW, the event is just a string, which will be parsed in the javascript code of the web page.
0
 

Author Comment

by:dhenderson12
ID: 40548956
ok, I resolved the problem:  just made the async method I was calling return a void.
0
 

Author Closing Comment

by:dhenderson12
ID: 40548957
thanks for the help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question