ListLabel21: Intermittent error during a print preview

Using ListLabel21.dll.

We’re seeing an intermittent failure where the Html5ViewerController can’t be instantiated due to a dynamic method security transparency violation — could this be related to dynamic code running before full trust is established on app cold start?

This sometimes corrects itself when refreshing the screen.

{“Message”:“An error has occurred.”,“ExceptionMessage”:“An error occurred when trying to create a controller of type ‘Html5ViewerController’. Make sure that the controller has a parameterless public constructor.”,“ExceptionType”:“System.InvalidOperationException”,“StackTrace”:" at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\r\n at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()“,“InnerException”:{“Message”:“An error has occurred.”,“ExceptionMessage”:“Attempt by security transparent method ‘DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure)’ to access security critical method ‘combit.ListLabel21.Web.Html5ViewerController…ctor()’ failed.”,“ExceptionType”:“System.MethodAccessException”,“StackTrace”:” at lambda_method(Closure )\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)"}}

1 Like

HI Matt,
in which Modus your Application is running, Full-Trust?

Yes, Full-Trust, I believe.

Since the problem only occurs occasionally and usually works on the second request, it could be that the App Pool Recycling is the problem.
Please try to set the shutdownlimit in the advanced options of the app pool to 0 or a much higher limit than 20 minutes.

you can also try to use a dummy job of List & Label so that all unmanaged ressources are already loaded. You can do it like this:
public class Startup
{
ListLabel _dummyLL; // important: do nothing with this instance!!!

   public void ConfigureServices(IServiceCollection services) { [...]  }

   private void OnShutDown()
   {
        _dummy.Dispose();
   }

}

Thank you Stefan. I tried changing the shutdown limit to 0 and 200, now I’m experiencing a different error:

{“Message”:“An error has occurred.”,“ExceptionMessage”:“Object reference not set to an instance of an object.”,“ExceptionType”:“System.NullReferenceException”,“StackTrace”:" at combit.ListLabel21.Web.Html5ViewerController.InitReportParameters(String instanceId)\r\n at lambda_method(Closure , Object , Object )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}

ChatGPT suggested:
That means something expected to be initialized is null—likely the instanceId is:

  • missing
  • expired
  • or doesn’t map to a live ListLabel session**

Since I’m not able to find any such instantiating of InstanceId in our codebase, I was wondering if you knew of an easy fix. Until then I’ll see if we’re creating the instance in an external package. Any advice will be appreciated.

Unfortunately, we are not aware of the error message. Does the message also occur with our sample? Perhaps a debug log with Debwin will also help. To do this, start Debwin as administrator on the server and restart the IIS. You are also welcome to contact our support team. In the current List & Label there have been major changes in the web area. The viewer has now been completely redeveloped on the basis of React.