This error occurs if I use CallContext.LogicalSetData before method IsolatedRazorEngineService.Create() and set an entity that is not marked [Serializable].
here is a demo to produce this error.
using RazorEngine.Templating;
using System.Runtime.Remoting.Messaging;
namespace WorkerRole
{
public class User
{
public string Name { get; set; }
}
internal class Program
{
static void Main(string[] args)
{
var user = new User();
CallContext.LogicalSetData("123", user);
using (var service = IsolatedRazorEngineService.Create())
{
}
}
}
}
error is
System.Runtime.Serialization.SerializationException: 'Type 'WorkerRole.User' in assembly 'WorkerRole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.'
This error occurs if I use
CallContext.LogicalSetData
before methodIsolatedRazorEngineService.Create()
and set an entity that is not marked [Serializable].here is a demo to produce this error.
error is