question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Task with Raise

See original GitHub issue

My event handlers run async code.

When I raise my event handlers, I’m in an async context, so I can easily await.

What are your thoughts on a WeakEventSourceAsync with a Task Raise(object sender, TEventArgs e)?

edit: Typo with signature.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
thomaslevesquecommented, Jan 21, 2019

This issue has been resolved in release 3.1.0-beta.1.

Thanks again, @pauldotknopf!

BTW, I tried to refactor to share some of the code between the sync and async implementations, but couldn’t find a good way to do it. If you look at the diff between the two files, there are very few differences, but they’re usually either on the return type (void vs Task, and void can’t be used as a generic type parameter), or the use of await, which can’t easily refactored.

0reactions
thomaslevesquecommented, Sep 24, 2019

Hey @pauldotknopf, I just realized I had never released a stable version with this change… Sorry about that. I just published 3.1.0.

There should also be a 4.0.0 coming soon, with a few breaking changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to raise an event inside a Task?
How to raise an event inside a Task? · 1. Yes, see blog.stephencleary.com/2012/02/… · The TPL is a way of managing asynchronous operations...
Read more >
Event Raise Task
The Event-Raise task represents the location of a user-defined event. A user-defined event is the sequence of tasks in the branch from the ......
Read more >
Using the Event-Raise Task for a User-Defined Event
In the Workflow Designer workspace, create an Event-Raise task and place it in the workflow to represent the user-defined event you want to...
Read more >
Task-based asynchronous programming - .NET
In this article, learn about task-based asynchronous programming through the Task Parallel Library (TPL) in .NET.
Read more >
Advanced Tips for Using Task.Run with Async/Await
Let's dive deeper into using Task.Run with Async/Await and determine whether or not we should use Task.Run with ASP.NET Core.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found