When trying to “Hello World” with mono/.net 4.5, MVC5 in Xamarin studio on Mac OS X 10.10 (Yosemite)

Xamarin provides a “Hello World” of sorts with its vanilla asp.net MVC solution. And, naturally, it works. It also cheats because it doesn’t use a model, it’s just a controller with a view.

So, I decided to try this “Hello World” example by Chad Lung, this one uses a model. And, naturally, this one generates an error message.

System.TypeLoadException
Could not load type ‘System.Web.UnvalidatedRequestValuesBase’ from assembly ‘System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.Mvc.
Exception stack trace:
at System.Web.Mvc.FormValueProviderFactory.GetValueProvider (System.Web.Mvc.ControllerContext controllerContext) [0x00000] in :0
at System.Web.Mvc.ValueProviderFactoryCollection.GetValueProvider (System.Web.Mvc.ControllerContext controllerContext) [0x00000] in :0
at System.Web.Mvc.ControllerBase.get_ValueProvider () [0x00000] in :0
at System.Web.Mvc.ControllerActionInvoker.GetParameterValue (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ParameterDescriptor parameterDescriptor) [0x00000] in :0
at System.Web.Mvc.ControllerActionInvoker.GetParameterValues (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionDescriptor actionDescriptor) [0x00000] in :0
at System.Web.Mvc.Async.AsyncControllerActionInvoker+c__DisplayClass21.b__19 (System.AsyncCallback asyncCallback, System.Object asyncState) [0x00000] in :0

Thoughts.
I’m sure that asp.net error messages could be less terrifying.
I wonder how many other people are using Mono/Xamarin/asp.net MVC on Mac OS X 10? Probably about 3.

I’ve googled the error. Found this: http://curtis.schlak.com/2014/02/04/setup-asp-net-mvc-4-on-monodevelop-4.2.html
Written over 12 months ago and it appears that things have moved on since then (assumption I came too after noticing that
my menu options are slightly different to the ones described in this post).
I have also seen that some people suggest copying a different version of a .dll into my Xamarin solution. Pretty terrifying, considering that my expected result here is a web page with “Hello world” written on it.

Others suggest downgrading to version 4 of asp.net MVC. This sounds like the most “solution-that-I’m-willing-to-try-able” solution.

It’ll have to be another night, though, as I’m off to bed now (completely wasted couple of hours… bloody asp.net).

Advertisements