DotNetIsolator icon indicating copy to clipboard operation
DotNetIsolator copied to clipboard

MessagePackDynamicObjectResolverException from IsolatedRuntime.Invoke

Open khalidabuhakmeh opened this issue 2 years ago • 0 comments

👋 Hello,

I'm trying to recreate the Minimal API sample from your recent YouTube video (great video btw), but I seem to get a MessagePack serialization issue with the latest version of DotNetIsolator (0.1.0-preview.10032). The error details are below.

I have the following environment:

  • macOS
  • .NET 8.0.100-preview.4.23260.5
  • DotNetIsolator 0.1.0-preview.10032
MessagePack.Internal.MessagePackDynamicObjectResolverException: can't find matched constructor. type:DotNetIsolator.IsolatedRuntime
         at MessagePack.Internal.ObjectSerializationInfo.CreateOrNull(Type type, Boolean forceStringKey, Boolean contractless, Boolean allowPrivate, Boolean dynamicMethod)
         at MessagePack.Internal.DynamicObjectTypeBuilder.BuildFormatterToDynamicMethod(Type type, Boolean forceStringKey, Boolean contractless, Boolean allowPrivate)
         at MessagePack.Resolvers.DynamicContractlessObjectResolverAllowPrivate.FormatterCache`1..cctor()
      --- End of stack trace from previous location ---
         at MessagePack.FormatterResolverExtensions.Throw(TypeInitializationException ex)
         at Serialize(Byte[][], Object[], MessagePackWriter&, <>c__DisplayClass0_0, MessagePackSerializerOptions)
         at MessagePack.Internal.AnonymousSerializableFormatter`1.Serialize(MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
         at MessagePack.Formatters.TypelessFormatter.Serialize(MessagePackWriter& writer, Object value, MessagePackSerializerOptions options)
         at MessagePack.MessagePackSerializer.Serialize[T](MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
         --- End of inner exception stack trace ---
         at MessagePack.MessagePackSerializer.Serialize[T](MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
         at MessagePack.MessagePackSerializer.Serialize[T](T value, MessagePackSerializerOptions options, CancellationToken cancellationToken)
         at MessagePack.MessagePackSerializer.Typeless.Serialize(Object obj, MessagePackSerializerOptions options, CancellationToken cancellationToken)
         at DotNetIsolator.IsolatedRuntime.CopyObject[T](T value)
         at DotNetIsolator.IsolatedRuntime.Invoke[TRes](Func`1 value)
         at Program.<>c__DisplayClass0_0.<<Main>$>b__0() in /Users/khalidabuhakmeh/RiderProjects/HelloWasi/WebApplication1/Program.cs:line 15
         at lambda_method1(Closure, Object, HttpContext)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

khalidabuhakmeh avatar May 18 '23 13:05 khalidabuhakmeh