Home
Options

SignalR NotSupportedException error at LinqPad using .NET 7 but no error for .NET 6

Want to report an error, at LinqPad 7 using .NET 7 will have the error below.

It was tested at VS using .NET 7 for the same code, no error will be raised at VS. And tried to switch to .NET 6 at LinqPad, no error raised too.

I saw a breaking change for .NET 7 for the error message > https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/7.0/collectible-assemblies.

fail: Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher[8]
      Failed to invoke hub method 'SendMessage'.
      System.NotSupportedException: A non-collectible assembly may not reference a collectible assembly.
         at System.Reflection.Emit.ModuleBuilder.GetTypeRefNested(Type type, Module refedModule)
         at System.Reflection.Emit.ModuleBuilder.GetTypeTokenWorkerNoLock(Type type, Boolean getGenericDefinition)
         at System.Reflection.Emit.ModuleBuilder.GetTypeTokenInternal(Type type, Boolean getGenericDefinition)
         at System.Reflection.Emit.TypeBuilder..ctor(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, ModuleBuilder module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType)
         at System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces)
         at Microsoft.AspNetCore.SignalR.Internal.TypedClientBuilder`1.GenerateInterfaceImplementation(ModuleBuilder moduleBuilder)
         at Microsoft.AspNetCore.SignalR.Internal.TypedClientBuilder`1.GenerateClientBuilder()
         at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
         at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
         at System.Lazy`1.CreateValue()
         at Microsoft.AspNetCore.SignalR.Internal.TypedClientBuilder`1.Build(IClientProxy proxy)
         at ChatHub.SendMessage(ChatMessage message) in C:\Users\xxxx\AppData\Local\Temp\LINQPad7\_jsgciubs\txktkn\LINQPadQuery:line 38
         at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.ExecuteMethod(ObjectMethodExecutor methodExecutor, Hub hub, Object[] arguments)
         at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.<Invoke>g__ExecuteInvocation|18_0(DefaultHubDispatcher`1 dispatcher, ObjectMethodExecutor methodExecutor, THub hub, Object[] arguments, AsyncServiceScope scope, IHubActivator`1 hubActivator, HubConnectionContext connection, HubMethodInvocationMessage hubMethodInvocationMessage, Boolean isStreamCall)

Thanks.

Comments

Sign In or Register to comment.