Skip to content

Instantly share code, notes, and snippets.

@ForbesLindesay
Created November 23, 2012 03:05
Show Gist options
  • Save ForbesLindesay/4133844 to your computer and use it in GitHub Desktop.
Save ForbesLindesay/4133844 to your computer and use it in GitHub Desktop.
NAct doesn't forward exceptions properly...
using NAct;
using System;
using System.Threading.Tasks;
namespace NActFailureDemo
{
class Program
{
static void Main(string[] args)
{
Run();
Console.ReadLine();
}
static async void Run()
{
IActorDemo demo = new ActorDemo();
try
{
await demo.DoAction();
}
catch (Exception ex)
{
Console.WriteLine("An exception is caught when not using actors");
}
demo = ActorWrapper.WrapActor<IActorDemo>(() => new ActorDemo());
try
{
await demo.DoAction();
}
catch (Exception ex)
{
Console.WriteLine("This string is never logged!!");
//The exception gets swallowed and never reported
}
}
}
public interface IActorDemo : IActor
{
Task DoAction();
}
public class ActorDemo : IActorDemo
{
public async Task DoAction()
{
throw new Exception("A demo exception");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment