Upgrading from 5.4 to 5.8.X throws exception while executing AutoQuery and all other queries

Hi,

I have upgraded service stack from 5.4 to 5.8 and in some projects its is upgraded to 5.8.1. After upgrading, I am getting following exception-
“ErrorCode”: “MissingMethodException”,

“Message”: “Method not found: ‘ServiceStack.ResponseStatus ServiceStack.DtoUtils.ToResponseStatus(System.Exception)’.”,

“StackTrace”: “System.MissingMethodException: Method not found: ‘ServiceStack.ResponseStatus ServiceStack.DtoUtils.ToResponseStatus(System.Exception)’.\r\n at ServiceStack.TaskExt.GetResult(Task task)\r\n at ServiceStack.Host.ServiceController.<>c__DisplayClass41_1.b__1(Task task)\r\n at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()\r\n at System.Threading.Tasks.Task.Execute()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at ServiceStack.Host.ServiceController.d__49.MoveNext()\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at ServiceStack.Host.RestHandler.d__14.MoveNext()\r\n”,

On debugging the code I found that, it was throwing error in following method-
public QueryResponse ExecuteQuery<T, TK>(QueryDb<T, TK> req, Dictionary<string, string> queryArgs = null, bool overrideRLS = false)
{
QueryResponse queryResponse = null;
SetSessionBeforeCall(Db, dbConnection =>
{
if(queryArgs == null) queryArgs = Request.GetRequestParams();
var q = AutoQuery.CreateQuery(req, queryArgs, Request);
queryResponse = new QueryResponse()
{
Offset = q.Offset.GetValueOrDefault(0),
Total = (int) dbConnection.Count(q),
Results = dbConnection.LoadSelect<TK, T>(q)
};
}, overrideRLS);
return queryResponse;
}

Further debugging to ServcieStack library, found error occurred in ServiceController at
//Executes the service and returns the result
response = serviceExec(request, requestDto);
Can you help me to resolve the issue ?

Missing method/type exceptions are the result of using dirty packages of different versions of ServiceStack together.

You need to use the same version of ServiceStack in all projects, if you’re using the v5.8.1 pre-release packages on MyGet that’s what all its project references need to be using. Using different v5.8.1 packages at different times can also get dirty and throw this Exception which you can resolve by clearing your NuGet packages cache and re-downloading them again which will ensure it downloads the latest v5.8.1 packages.