Logo depois de criar a view, pagina 15, eu recebo um erro no foreach. e não consigo visualizar as categorias…
System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Referência de objeto não definida para uma instância de um objeto.
Source=App_Web_nw5geknx
StackTrace:
em ASP._Page_Views_Categorias_Index_cshtml.Execute() na c:\users\brat\documents\visual studio 2015\Projects\Projeto\Projeto\Views\Categorias\Index.cshtml:linha 26
em System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
em System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
em System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
em System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
em System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
em System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
em System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
em System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) em System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
InnerException: