vlingo-net / xoom-net-actors

Type safe Actor Model toolkit for reactive concurrency and resiliency using C# and other .NET languages.
Mozilla Public License 2.0
39 stars 18 forks source link

ProxyGenerator doesn't support generic methods #59

Closed tjaskula closed 5 years ago

tjaskula commented 5 years ago

Non generic interface with a generic method is not supported and fails at compilation. The example of the interface:

public interface IGenericMethod
    {
        void Handle<T>(string name, Action<T> consumer) where T : GenericHandler;
    }

Generation of the proxy fails with the following error:

vlingo-net/actors[Debug]: vlingo-net/actors: Generating proxy for main: IGenericMethod
Dynamically generated class source for Vlingo.Actors.Tests.GenericMethod__Proxy did not compile because: The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
   at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input)
vlingo-net/actors[Debug]: vlingo-net/actors: Generating proxy for test: IGenericMethod
Dynamically generated class source for Vlingo.Actors.Tests.GenericMethod__Proxy did not compile because: The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
   at Vlingo.Common.Compiler.DynaCompiler.Compile(Input input)
Actor proxy IGenericMethod not created for main or test: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
   at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 91
   at Vlingo.Actors.ActorProxy.CreateFor(Type protocol, Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 45
   at Vlingo.Actors.ActorProxy.CreateFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 19
   at Vlingo.Actors.Stage.ActorProxyFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 450
   at Vlingo.Actors.Stage.ActorProtocolFor[T](Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 394
vlingo-net/actors[Error]: vlingo-net/actors: FAILED: Actor proxy IGenericMethod not created for main or test: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
vlingo-net/actors[Error] [Exception]: Actor proxy IGenericMethod not created for main or test: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
vlingo-net/actors[Error] [StackTrace]:    at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 91
   at Vlingo.Actors.ActorProxy.CreateFor(Type protocol, Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 45
   at Vlingo.Actors.ActorProxy.CreateFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 19
   at Vlingo.Actors.Stage.ActorProxyFor[T](Actor actor, IMailbox mailbox) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 450
   at Vlingo.Actors.Stage.ActorProtocolFor[T](Definition definition, Actor parent, IAddress maybeAddress, IMailbox maybeMailbox, ISupervisor maybeSupervisor, ILogger logger) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/Stage.cs:line 394
vlingo-net/actors[Error] [InnerException]: Actor proxy IGenericMethod not created because: Dynamically generated class source did not compile: Vlingo.Actors.Tests.GenericMethod__Proxy
vlingo-net/actors[Error] [InnerException-StackTrace]:    at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, ProxyGenerator generator, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 128
   at Vlingo.Actors.ActorProxy.TryGenerateCreate(Type protocol, Actor actor, IMailbox mailbox, String targetClassName, String lookupTypeName) in /Users/tjaskula/Documents/GitHub/vlingo-net-actors/src/Vlingo.Actors/ActorProxy.cs:line 87