5.1 Razor Not Working on Mac

I upgraded packages from 4.5.4 to 5.1.0 and am not able to get the app to start with the Razor plug in enabled.

Using Visual Studio for Mac, Project is framework 4.6.1

Parent class vtable failed to initialize, due to:  assembly:/private/var/folders/f1/2hsnpclj453642xsvy6304j80000gn/T/kevin-temp-aspnet-0/5f67d5ae/assembly/shadow/20e2e6e9/587b19be_7899ff57_00000001/ServiceStack.Razor.dll type:AggregateCodeTransformer member:(null) signature:<none>
Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): ServiceStack.

Exception stack trace:
  at ServiceStack.ServiceStackHost.OnStartupException (System.Exception ex) [0x00024] in <629ec152372546cf812fe4a698c7a784>:0 
  at ServiceStack.ServiceStackHost.LoadPluginsInternal (ServiceStack.IPlugin[] plugins) [0x0002a] in <629ec152372546cf812fe4a698c7a784>:0 
  at ServiceStack.ServiceStackHost.OnAfterInit () [0x00458] in <629ec152372546cf812fe4a698c7a784>:0 
  at ServiceStack.ServiceStackHost.Init () [0x00224] in <629ec152372546cf812fe4a698c7a784>:0 
  at ShipNow.Global.Application_Start (System.Object sender, System.EventArgs e) [0x0001c] in /Users/kevin/Projects/ShipNow/ShipNow/ShipNow/Global.asax.cs:35 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305

ServiceStack Server libraries does not support Mono. If you want to develop with ServiceStack on Mac/Linux you should port to .NET Core - which is better (and actively) supported/maintained and results it much greater performance.

We’ve made it as easy as possible to port to .NET Core where most of your source code should remain the same, see .NET Core docs for more info:

Best way is to start with one of the web projects than copy your existing code over.

Unfortunately ServiceStack.Razor needed to be rewritten on top of MVC Razor but we were able to retain a lot of its features:

Wow… been doing this for 3 years without any real issues. It will be easier for me to move off razor than to port to dotnet core… Yikes.

You can stay on your existing version but porting to .NET Core will be more beneficial in the long run (and ServiceStack makes it as easy as possible - where we’ve ported most Live Demos to .NET Core including Razor Rockstars).

Running server software on Mono is a dead-end, everyone’s moving off it, it’s slow (especially for Razor), has incompatibility issues, unmaintained/poorly supported, etc.

We’re not fans of the build/tooling complexity of Razor either, if you’re considering moving off razor check out:

It’s the same version with none of Razor’s build/tooling complexity that works the same everywhere, including ASP.NET MVC both .NET Framework and .NET Core.

That’s still copy that was left over from the v3 days. When we actually started providing commercial support from v4+ in 2013 we excluded Mono since we couldn’t provide support for a platform with known issues that wasn’t properly maintained. We still support Mono client libraries since that’s the primary use-case for using Mono, but not as a supported platform for running ServiceStack Server. This is in contrast to .NET Core which is a high-performance and actively developed/maintained cross-platform runtime that supports Windows/OSX/Linux.

The platforms we support are highlighted on our download page: https://servicestack.net/download

And on our ServiceStack Issues page:

The primary change of ServiceStack.Razor between v4 and v5 was that v5 became a Strong named library which allowed us to switch to use the official Microsoft.AspNet.Razor project for compiling and executing Razor Views which is what I’m assuming Mono has issues with. If that is the issue the only solution would be to revert to v4.x.