TypeLoadException when debugging project after upgrade to 5.8.1


I’ve recently upgraded an existing project to ServiceStack 5.8.1 from 5.8.0, and all dependencies as well. Now, when trying to start locally to debug, I receive a TypeLoadException. Here is the stack trace:

at ServiceStack.NativeTypesFeature..ctor() in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\NativeTypesFeature.cs:line 85 at ServiceStack.ServiceStackHost..ctor(String serviceName, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServiceStackHost.cs:line 143 at ServiceStack.AppHostHttpListenerPoolBase..ctor(String serviceName, Int32 poolSize, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppHostHttpListenerPoolBase.cs:line 75 at ServiceStack.AppHostHttpListenerPoolBase..ctor(String serviceName, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppHostHttpListenerPoolBase.cs:line 71 at CogLoadWinService.Program.AppHost..ctor() in C:\dev\GognosLoad\CogLoadWinService\AppHost.cs:line 25 at CogLoadWinService.Program.Main(String[] args) in C:\dev\GognosLoad\CogLoadWinService\Program.cs:line 25

When I downgrade the ServiceStack package alone to 5.8.0, the problem no longer occurs. I’ve tried clearing my Nuget cache, to no avail. We are using .Net Framework 4.6.1. Any advice would be really appreciated, thanks!

These Type or invalid Method issues from using pre-release packages on MyGet like v5.8.1 are always resolved when clearing out your NuGet packages, if you’re using .NET Framework you also need to clear out your solutions /packages folder as well. If that doesn’t work you can try clearing out your /bin and /obj folders to remove any trace of the old binaries.