Note that there are some explanatory texts on larger screens.

plurals
  1. POException NullReferenceException in controller (asp.net mvc)
    text
    copied!<p>There are Supplier model and User model in my project, every Supplier has a few Users<br> Supplier model</p> <pre><code>public class SupplierRow { public Guid Id { get; set; } public string FullName { get; set; } public bool Subscribed { get; set; } public bool Active { get; set; } public int Visits { get; set; } public List&lt;UserRow&gt; Users { get; set; } public bool AllInactive { get { foreach (UserRow ur in Users) { if (ur.Status == 1) return false; } return true; } } } </code></pre> <p>and User model</p> <pre><code>public class UserRow { public Guid Id { get; set; } public string FullName { get; set; } public string Name { get; set; } public string Email { get; set; } public int Status { get; set; } public int Role { get; set; } public Guid SupplierId { get; set; } } </code></pre> <p>then I use my models in controller</p> <pre><code> public ActionResult Grid(bool? active) { var suppliers = Context.Suppliers.AsNoTracking() .WhereIf(active != null, e =&gt; e.Active == active) .Select(e =&gt; new SupplierRow { Id = e.Id, FullName = e.FullName, Active = e.Active, Visits = e.Visits, }) .ToList(); List&lt;Guid&gt; supplierIds = new List&lt;Guid&gt;(); foreach (SupplierRow sr in suppliers) { supplierIds.Add(sr.Id); } var users = Context.Users.AsNoTracking() .Where(e =&gt; supplierIds.Contains(e.SupplierId.Value)) .Select(e =&gt; new UserRow { Id = e.Id, FullName = e.FullName, Email = e.Email, Name = e.Name, Status = e.Status, Role = e.Role, SupplierId = e.SupplierId.Value }).ToList(); foreach (UserRow ur in users) { foreach (SupplierRow sr in suppliers) { if (ur.SupplierId == sr.Id) { sr.Users.Add(ur); } } } return PartialView("_Grid", suppliers); } </code></pre> <p>but when I try to debug my project I get some exception here <img src="https://i.stack.imgur.com/zMUoH.png" alt="enter image description here"> What's wrong? How can I fix that?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload