• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 132
  • Last Modified:

make async method com friendly

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
dhenderson12
Asked:
dhenderson12
  • 4
  • 2
1 Solution
 
käµfm³d 👽Commented:
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
 
dhenderson12Author Commented:
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
 
käµfm³d 👽Commented:
My guess is that you'll have to fall back to regular threading, but hold out for more responses.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
dhenderson12Author Commented:
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
 
dhenderson12Author Commented:
ok, I resolved the problem:  just made the async method I was calling return a void.
0
 
dhenderson12Author Commented:
thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now