I’ve managed to register an assembly but now I’m getting an error when trying to call a method on my grain:
Cannot find generated GrainReference class for interface '<MyAssembly>.CustomId.ICustomIdGrain'
Full Stack Trace
Cannot find generated GrainReference class for interface \u0027<MyAssembly>.CustomId.ICustomIdGrain\u0027
at Orleans.Runtime.TypeMetadataCache.GetGrainReferenceType(Type interfaceType)
at Orleans.GrainFactory.MakeCaster(Type interfaceType)
at System.Collections.Concurrent.ConcurrentDictionary\u00602.GetOrAdd(TKey key, Func\u00602 valueFactory)
at Orleans.GrainFactory.Cast(IAddressable grain, Type interfaceType)
at Orleans.GrainFactory.Cast[TGrainInterface](IAddressable grain)
at <MyAssembly>.CustomId.CustomId.GetGrain(DomainId appId) in C:\Users\pains\source\repos\SQX\squidex\backend\src\<MyAssembly>\CustomId\CustomId.cs:line 28
at <MyAssembly>.CustomId.CustomId.GetNextId(DomainId appId, String schemaName) in C:\Users\pains\source\repos\SQX\squidex\backend\src\<MyAssembly>\CustomId\CustomId.cs:line 23
at <MyAssembly>.CustomId.CustomIdMiddleware.SetCustomId(CommandContext context, CreateContent command) in C:\Users\pains\source\repos\SQX\squidex\backend\src\<MyAssembly>\CustomId\CustomIdMiddleware.cs:line 59
at <MyAssembly>.CustomId.CustomIdMiddleware.HandleAsync(CommandContext context, NextDelegate next) in C:\Users\pains\source\repos\SQX\squidex\backend\src\<MyAssembly>\CustomId\CustomIdMiddleware.cs:line 45
at Squidex.Infrastructure.Commands.CustomCommandMiddlewareRunner.HandleAsync(CommandContext context, NextDelegate next) in C:\Users\pains\source\repos\SQX\squidex\backend\src\Squidex.Infrastructure\Commands\CustomCommandMiddlewareRunner.cs:line 32
at Squidex.Web.CommandMiddlewares.ETagCommandMiddleware.HandleAsync(CommandContext context, NextDelegate next) in C:\Users\pains\source\repos\SQX\squidex\backend\src\Squidex.Web\CommandMiddlewares\ETagCommandMiddleware.cs:line 55
at Squidex.Infrastructure.Commands.InMemoryCommandBus.PublishAsync(ICommand command) in C:\Users\pains\source\repos\SQX\squidex\backend\src\Squidex.Infrastructure\Commands\InMemoryCommandBus.cs:line 71
at Squidex.Areas.Api.Controllers.Contents.ContentsController.InvokeCommandAsync(ICommand command) in C:\Users\pains\source\repos\SQX\squidex\backend\src\Squidex\Areas\Api\Controllers\Contents\ContentsController.cs:line 713
at Squidex.Areas.Api.Controllers.Contents.ContentsController.PostContent(String app, String name, NamedContentData request, Boolean publish, Nullable\u00601 id) in C:\Users\pains\source\repos\SQX\squidex\backend\src\Squidex\Areas\Api\Controllers\Contents\ContentsController.cs:line 445
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeActionMethodAsync\u003Eg__Awaited|12_0(ControllerActionInvoker invoker, ValueTask\u00601 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeNextActionFilterAsync\u003Eg__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State\u0026 next, Scope\u0026 scope, Object\u0026 state, Boolean\u0026 isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.\u003CInvokeInnerFilterAsync\u003Eg__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.\u003CInvokeNextExceptionFilterAsync\u003Eg__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
I’ve exhausted my Google-Fu and am hoping that you can suggest something simple that I’ve missed.
I’m pretty sure I’ve got everything set up right:
- I’ve referenced ‘Microsoft.Orleans.Core’ and ‘Microsoft.Orleans.CodeGenerator.MSBuild’ v3.4.0 nuget packages in my project
- I’ve added my project as a reference in the main Squidex web project.
- I’ve registered my assembly in the Orleans Setup following the pattern that’s there:
- I’ve compared my project to both ‘Squidex.Domain.Apps.Entities’ and ‘Squidex.Infrastructure’
- I’ve checked with ildasm that the GeneratedCode is created in the assembly:
- I’m running this locally in Visual Studio 2019 for the backend and Visual Studio Code for the frontend.
Hopefully it’s something simple that I’ve missed.
Thanks