Json Result not returning value in asp.net core RRS feed

  • Question

  • User2041008840 posted


    I am getting error "

    Inspecting the state of an object in the debugger of type System.Reflection.MethodBase is not supported in this context

    I applied breakpoint on code then i found this error. on browser the page is loading and nothing is returning. 
    I am using asp.net core 3.1 version

    this is my code

            public JsonResult GetServiceChallanNo()
                var result = _context.StockIn.Where(a => a.ID == 29);
                return Json(result);

    Tuesday, December 24, 2019 10:15 AM

All replies

  • User475983607 posted

    There are several issue with your code.  The code is returning a LINQ expression not an actual type.

    Below is a know working example that using the adventure works database,

    public ActionResult Index()
        var results = DbContext.Customers.Where(c => c.CustomerID == 1).ToList();
        return Json(results);

    The community cannot verify your query returns records and we cannot see the client code which is where the results return. 

    Tuesday, December 24, 2019 1:13 PM
  • User2041008840 posted

    I remove the lazyloading from startup.cs and it working fine

    Tuesday, December 24, 2019 6:42 PM