1

ServiceStack version 5.0.2

I wondered if anyone could give me a pointer to a possible cause of the error shown in the stack trace below. (I am a junior developer, so I am very new to all this.)

We have an ASP.net MVC application which has some ServiceStack.Mvc integration in it. (I suspect we are using ServiceStack's auth provider functionality to handle authentication on MVC controller action requests).

Today we witnessed errors appearing when trying to login to our Web Application. Below is the stack trace of one of the errors that appeared.

The Index action on "MyController" has an 'Authenticate' attribute on it.

[Authenticate]
public class MyController : ServiceStackController<AuthUserSession>

All I can deduct from the stack trace is that after the MVC controller action is invoked, the service stack ServiceRunner tries to execute a service (I have no idea which one) and there is somekind of null reference within the execute method which is throwing an exception.

I wondered if Myths or anyone else had ever seen this before, or could shed any light whatsoever on what service the service runner may have been trying to execute or any information on a possible cause.

The issue disappeared after the web server was rebooted

   Exception type: NullReferenceException 
    Exception message: Object reference not set to an instance of an object.   



Stack trace:    at ServiceStack.DtoUtils.CreateErrorResponse(Object request, Exception ex)
       at ServiceStack.Host.ServiceRunner`1.HandleException(IRequest request, TRequest requestDto, Exception ex)
       at ServiceStack.Host.ServiceRunner`1.Execute(IRequest request, Object instance, TRequest requestDto)
       at ServiceStack.Host.ServiceRunner`1.Process(IRequest requestContext, Object instance, Object request)
       at ServiceStack.Host.ServiceExec`1.Execute(IRequest request, Object instance, Object requestDto, String requestName)
       at ServiceStack.Host.ServiceRequestExec`2.Execute(IRequest requestContext, Object instance, Object request)
       at ServiceStack.Host.ServiceController.ManagedServiceExec(ServiceExecFn serviceExec, IService service, IRequest request, Object requestDto)
       at ServiceStack.Host.ServiceController.<>c__DisplayClass36_0.<RegisterServiceExecutor>b__0(IRequest req, Object dto)
       at ServiceStack.Host.ServiceController.Execute(Object requestDto, IRequest req)
       at ServiceStack.InProcessServiceGateway.ExecSync[TResponse](Object request)
       at ServiceStack.InProcessServiceGateway.Send[TResponse](Object requestDto)
       at MyApplication.Controllers.MyController.Index()
  • Possible duplicate of [What is a NullReferenceException, and how do I fix it?](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – John Wu Apr 09 '18 at 22:19

1 Answers1

1

I've not seen this error before, but the StackTrace originated from your MyController.Index() Action.

The ServiceStackController doesn't use the Gateway, neither does the ExecuteServiceStackFilters which executes the AuthenticateAttribute on your MVC Controller. So I'd say it's something in your MyController.Index() implementation that's causing it.

mythz
  • 141,670
  • 29
  • 246
  • 390