Closed elmortega closed 8 years ago
Does the silo successfully load your assembly? You should it scan for assemblies at startup, it tells you if it found anything in each of the DLLs it looked in...
How can I make sure the grain assembly was correctly deployed and loaded in the silo?
Orleans searches the directory where the host application is located, as well as the Applications
sub-directory, and all directories under it.
I thought I could just put my grain interfaces and implementation code in the webapp's model folder. but I guess that way the silo host wouldn't be able to load my grain classes, right?
loadedAssemblies contains only one, the OrleansRuntime.DLL
How are you hosting the Orleans silos?
Are your grain assemblies in the bin\debug
directory of the console application?
A convenient way of doing that is to add them as references and set them to copy locally.
did that fix the problem?
It was solved when using the v1.1.0-VSIX project templates
I'm facing the same problem. In my case, I'm initializing the TestCluster from inside a unit test's constructor. The Grain and GrainInterface projects are referenced by the Unit Tests and are available in the bin/x64/Debug folder of the Unit Tests project. Still, the Silo complains of not having the assembly loaded.
@asifshiraz Can you open a separate issue with information about which version you are running. Are you grain classes public, BTW?
Be aware that if you have your grains in an .exe file and include this as a reference in your UnitTest project Orleans will not scan this assembly for Grains, they must be in a .dll file instead.
I just came across this and found out my grain class was not inheriting Orleans.Grain
and was only implementing my grain interface. Adding Orleans.Grain
fixed it for me.
A code analyzer could potentially help find such issues and produce warnings.
I just came across this and found out my grain class was not inheriting Orleans.Grain and was only implementing my grain interface. Adding Orleans.Grain fixed it for me.
@philrowan-mtb thanks a lot
I was getting the same issue. I was properly using the grain interface type when attempting to obtain the grain implementation via the GrainFactory; however, I finally solved it by adding a reference to the nuget package: Microsoft.Orleans.OrleansCodeGenerator.Build in the silo, grains, and grain interfaces projects.
I think perhaps the error message should be a little more accurate or at least contain verbiage pertaining to the above nuget dependency requirement. Or better yet the silo should fail to startup and throw an exception.
I finally solved it by adding a reference to the nuget package: Microsoft.Orleans.OrleansCodeGenerator.Build in the silo, grains, and grain interfaces projects.
There's no need to add it to the silo project.
Note: Microsoft.Orleans.CodeGenerator.MSBuild
is a viable alternative to Microsoft.Orleans.OrleansCodeGenerator.Build
I´m getting this exception:
An unhandled exception occurred while processing the request.
ArgumentException: Cannot find an implementation class for grain interface: OrleansWebAppTest.Models.IHello. Make sure the grain assembly was correctly deployed and loaded in the silo. Loaded grain assemblies: file:///C:/Users/byrmanager/Documents/Visual Studio 2015/Projects/TemporalProjects/orleans/src/OrleansConsoleHost/bin/Debug/OrleansRuntime.DLL en Orleans.Runtime.TypeCodeMapper.GetImplementation(Type interfaceType, String grainClassNamePrefix) en C:\Users\byrmanager\Documents\Visual Studio 2015\Projects\TemporalProjects\orleans\src\Orleans\IDs\TypeCodeMapper.cs:línea 17
The public bool TryGetGrainClassData method in the GrainInterfaceMap.cs returns false as it doesn´t seem to be able to get an implementation for the provided interface as the this.typeToInterfaceData.TryGetValue(GetTypeKey(interfaceType, false), out interfaceData) method returns false
In my project.json:
"frameworks": { "dnx451": { "dependencies": { "Orleans": "1.0.0-", "OrleansProviders": "1.0.0-" } } },