The issue:
System.InvalidOperationException
The view '~/Views/Mobile/ProfilesGridView.cshtml' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Mobile/ProfilesGridView.cshtml
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.ViewResult.FindView (System.Web.Mvc.ControllerContext context) [0x00083] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x0003b] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList`1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0000b] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList`1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0009b] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList`1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0009b] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters (System.Web.Mvc.ControllerContext controllerContext, System.Collections.Generic.IList`1[T] filters, System.Web.Mvc.ActionResult actionResult) [0x0000a] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass3_6.<BeginInvokeAction>b__4 () [0x000f8] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass3_1.<BeginInvokeAction>b__1 (System.IAsyncResult asyncResult) [0x00041] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`1[TResult].CallEndDelegate (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1[TResult].End () [0x00029] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (System.IAsyncResult asyncResult, System.Object tag) [0x00007] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Controller+<>c.<BeginExecuteCore>b__152_1 (System.IAsyncResult asyncResult, System.Web.Mvc.Controller+ExecuteCoreState innerState) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncVoid`1[TState].CallEndDelegate (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1[TResult].End () [0x00029] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (System.IAsyncResult asyncResult, System.Object tag) [0x00007] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End (System.IAsyncResult asyncResult, System.Object tag) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Controller.EndExecuteCore (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Controller+<>c.<BeginExecute>b__151_2 (System.IAsyncResult asyncResult, System.Web.Mvc.Controller controller) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncVoid`1[TState].CallEndDelegate (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1[TResult].End () [0x00029] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (System.IAsyncResult asyncResult, System.Object tag) [0x00007] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End (System.IAsyncResult asyncResult, System.Object tag) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Controller.EndExecute (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.MvcHandler+<>c.<BeginProcessRequest>b__20_1 (System.IAsyncResult asyncResult, System.Web.Mvc.MvcHandler+ProcessRequestState innerState) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncVoid`1[TState].CallEndDelegate (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1[TResult].End () [0x00029] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (System.IAsyncResult asyncResult, System.Object tag) [0x00007] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.Async.AsyncResultWrapper.End (System.IAsyncResult asyncResult, System.Object tag) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.MvcHandler.EndProcessRequest (System.IAsyncResult asyncResult) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest (System.IAsyncResult result) [0x00000] in <c11f3b1e27ba4255a48f3fa4d01496ab>:0
at System.Web.HttpApplication.async_handler_complete_cb (System.IAsyncResult ar) [0x00015] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System.Web/System.Web/HttpApplication.cs:988
What I have tried so far:
This ASP.NET MVC project is working fine on Windows. On Mac, I updated the packages to the latest version:
<package id="Microsoft.AspNet.Mvc" version="5.2.9" targetFramework="net472" />
<package id="Microsoft.AspNet.Razor" version="3.2.9" targetFramework="net472" />
and then in Views/web.config, updated MvcWebRazorHostFactory to latest version, i.e,
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
After making this change, some of the views started working which are just returning a view, for example:
public ActionResult ForgetPassword()
{
return View(); // Working
}
But it doesn't work, like:
return View("~/Views/Mobile/ProfilesGridView.cshtml", viewModel); // Not working
The view exists at location /Views/Mobile/ProfilesGridView.cshtml and is working on Windows.