Created
November 23, 2012 03:05
-
-
Save ForbesLindesay/4133844 to your computer and use it in GitHub Desktop.
NAct doesn't forward exceptions properly...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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