orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Could not load type 'Orleans.CodeGeneration.KnownAssemblyAttribute' in Orleans 8.1.0 nuget packages

Open UladzimirVyaziginTR opened this issue 1 year ago • 2 comments

I am trying to test my code on .NET 8 via TestCluster using Microsoft.Orleans.TestingHost 8.1.0 nuget package according to the instructions from https://learn.microsoft.com/en-us/dotnet/orleans/implementation/testing. My Fixture, CollectionFixture and Exception are represented below.

public sealed class OrleansInMemoryClusterFixture : IDisposable
{
	public TestCluster Cluster { get; } = new TestClusterBuilder().Build();

	public OrleansInMemoryClusterFixture() => Cluster.Deploy();

	public void Dispose() => Cluster.StopAllSilos();
}
[CollectionDefinition(nameof(OrleansInMemoryClusterCollection))]
public class OrleansInMemoryClusterCollection : ICollectionFixture<OrleansInMemoryClusterFixture>;
System.AggregateException : One or more errors occurred. (Could not load type 'Orleans.CodeGeneration.KnownAssemblyAttribute' from assembly 'Orleans.Core.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null'.) (The following constructor parameters did not have matching fixture data: OrleansInMemoryClusterFixture orleansInMemoryClusterFixture)
---- System.TypeLoadException : Could not load type 'Orleans.CodeGeneration.KnownAssemblyAttribute' from assembly 'Orleans.Core.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null'.
---- The following constructor parameters did not have matching fixture data: OrleansInMemoryClusterFixture orleansInMemoryClusterFixture

  Stack Trace: 
----- Inner Stack Trace #1 (System.TypeLoadException) -----
ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable)
CustomAttribute.IsDefined(RuntimeAssembly assembly, RuntimeType caType)
ReferencedAssemblyProvider.AddFromAssemblyLoadContext(HashSet`1 parts, Assembly assembly) line 82
ReferencedAssemblyProvider.GetRelevantAssemblies() line 23
ServiceCollectionExtensions.AddSerializer(IServiceCollection services, Action`1 configure) line 40
<10 more frames...>
TestCluster.DefaultCreateSiloAsync(String siloName, IConfiguration configuration) line 661
TestCluster.StartSiloAsync(Int32 instanceNumber, TestClusterOptions clusterOptions, IReadOnlyList`1 configurationOverrides, Boolean startSiloOnNewPort) line 724
TestCluster.InitializeAsync() line 636
TestCluster.DeployAsync() line 167
TestCluster.DeployAsync() line 202
TestCluster.Deploy() line 151
OrleansInMemoryClusterFixture.ctor() line 10
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

UladzimirVyaziginTR avatar Apr 22 '24 13:04 UladzimirVyaziginTR

This looks like an assembly version mismatch. Are you sure that all packages have been upgraded to v8.1.0?

ReubenBond avatar Apr 29 '24 22:04 ReubenBond

image

UladzimirVyaziginTR avatar Apr 30 '24 10:04 UladzimirVyaziginTR