Running Orleans via project references for debugging
dashkan opened this issue · 3 comments
I am trying to diagnose a serialization issue. So I added orleans as a git submodule and changed nuget reeferences to. project references throughout my project. But when running orleans via project references, it is not able to find any of the grain implementation classes.
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
Hosting failed to start
System.ArgumentException: Could not find an implementation for interface OrleansDashboard.IDashboardGrain
at Orleans.GrainInterfaceTypeToGrainTypeResolver.GetGrainType(GrainInterfaceType interfaceType) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Core/GrainInterfaceTypeToGrainTypeResolver.cs:line 102
at Orleans.GrainFactory.GetGrain(Type interfaceType, IdSpan grainKey, String grainClassNamePrefix) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Core/GrainFactory.cs:line 213
at Orleans.GrainFactory.GetGrain[TGrainInterface](Int64 primaryKey, String grainClassNamePrefix) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Core/GrainFactory.cs:line 51
at OrleansDashboard.Dashboard.ActivateDashboardGrainAsync()
at OrleansDashboard.Dashboard.Execute(CancellationToken cancellationToken)
at Orleans.Runtime.SiloLifecycleSubject.MonitoredObserver.OnStart(CancellationToken ct) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Lifecycle/SiloLifecycleSubject.cs:line 134
at Orleans.LifecycleSubject.OnStart(CancellationToken cancellationToken) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Lifecycle/LifecycleSubject.cs:line 118
at Orleans.Runtime.Scheduler.AsyncClosureWorkItem.Execute() in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Scheduler/ClosureWorkItem.cs:line 34
at Orleans.Runtime.Silo.StartAsync(CancellationToken cancellationToken) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Silo/Silo.cs:line 201
at Orleans.Hosting.SiloHostedService.StartAsync(CancellationToken cancellationToken) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Hosting/SiloHostedService.cs:line 28
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
Unhandled exception. System.ArgumentException: Could not find an implementation for interface OrleansDashboard.IDashboardGrain
at Orleans.GrainInterfaceTypeToGrainTypeResolver.GetGrainType(GrainInterfaceType interfaceType) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Core/GrainInterfaceTypeToGrainTypeResolver.cs:line 102
at Orleans.GrainFactory.GetGrain(Type interfaceType, IdSpan grainKey, String grainClassNamePrefix) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Core/GrainFactory.cs:line 213
at Orleans.GrainFactory.GetGrain[TGrainInterface](Int64 primaryKey, String grainClassNamePrefix) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Core/GrainFactory.cs:line 51
at OrleansDashboard.Dashboard.ActivateDashboardGrainAsync()
at OrleansDashboard.Dashboard.Execute(CancellationToken cancellationToken)
at Orleans.Runtime.SiloLifecycleSubject.MonitoredObserver.OnStart(CancellationToken ct) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Lifecycle/SiloLifecycleSubject.cs:line 134
at Orleans.LifecycleSubject.OnStart(CancellationToken cancellationToken) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Core/Lifecycle/LifecycleSubject.cs:line 118
at Orleans.Runtime.Scheduler.AsyncClosureWorkItem.Execute() in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Scheduler/ClosureWorkItem.cs:line 34
at Orleans.Runtime.Silo.StartAsync(CancellationToken cancellationToken) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Silo/Silo.cs:line 201
at Orleans.Hosting.SiloHostedService.StartAsync(CancellationToken cancellationToken) in /Users/user1/projects/proj1/lib/orleans/src/Orleans.Runtime/Hosting/SiloHostedService.cs:line 28
at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
This is not exclusive to the OrleansDashboard (which I am also referencing by source so that it may use project refs vs nuget packages)
I apologize if this is a duplicate or there are docs for running agains project references. I could not find any.
Your help is appreciated.
I have to tell you, that is not a supported scenario. It would be easier to add your project within Orleans, since the build system will work with less hassle. Still, it can probably be made to work. You will likely need at least two things:
- Reference the
Directory.Build.props
,Directory.Build.targets
and possiblyDirectory.Packages.props
files from corresponding files in your tree
Eg, you might have something like this in your Directory.Build.props
file
<Project>
<Import Project="./orleans/Directory.Build.props"/>
</Project>
- Add
<OrleansBuildTimeCodeGen>true</OrleansBuildTimeCodeGen>
to all of your projects in a<PropertyGroup>
Thank you for your quick response. Method above works. Completely understand that it is unsupported.
Glad to hear it worked for you, @dashkan!