I am getting an exception error when running the my ASP.NET web application, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am getting an exception error when running the my ASP.NET web application,

Hello, I am getting an exception error when running the my ASP.NET web application. I think it has to due my an enum by I am not sure. Server Error in '/' Application. ________________________________________ Value cannot be null. Parameter name: source Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: source Source Error: Line 8: <h1>ASP.NET</h1> Line 9: <div> Line 10: There are @Model.Count() restaurants in the db. Line 11: </div> Line 12: Source File: C:\Users\cef19\source\repos\OdeToFood\OdeToFood.Web\Views\Home\Index.cshtml Line: 10 Stack Trace: [ArgumentNullException: Value cannot be null. Parameter name: source] System.Linq.Enumerable.Count(IEnumerable`1 source) +4960432 ASP._Page_Views_Home_Index_cshtml.Execute() in C:\Users\cef19\source\repos\OdeToFood\OdeToFood.Web\Views\Home\Index.cshtml:10 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105 System.Web.WebPages.StartPage.RunPage() +17 System.Web.WebPages.StartPage.ExecutePageHierarchy() +73 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContex

8th Sep 2020, 5:02 PM
Love Coding
Love Coding - avatar
4 Answers
8th Sep 2020, 5:05 PM
Aditya
Aditya - avatar
+ 6
David Carroll sir thanks for informing me :) Love Coding nice of you that you figured out ;)
9th Sep 2020, 6:19 AM
Aditya
Aditya - avatar
+ 3
Love Coding Was it a routing parameter in your controller? Either way, glad you figured it out. 👌 Aditya A tip for you regarding that link you shared... That link was for the much older ASP.NET Web Forms. However, the call stack indicates this was for ASP.NET MVC. 😉
9th Sep 2020, 6:07 AM
David Carroll
David Carroll - avatar
+ 2
I figured it out. I forget to Add a parameter in the controller. I added it and that fixed the problem.
8th Sep 2020, 11:20 PM
Love Coding
Love Coding - avatar