0

When debugging with VS studio , i have faced an error that return

the function evaluation requires all threads to run enter image description here

How should I fix this

I use ef code first on this project

Here is the controller , DbContext and the Models

 public class ApplicationController : Controller
{
    ApplicationDbContext _context = new ApplicationDbContext();
    public ActionResult Index()
    {
        List<Brand> brands;
        brands = _context.Brands.ToList();

        return View(brands); 
    }
    }

DbContext

 public class ApplicationDbContext : DbContext
{
    public ApplicationDbContext()
        : base("name=ApplicationDbContext")
    {
    }   

    public virtual DbSet<Brand> Brands { get; set; }
    public virtual DbSet<Product> Products { get; set; }
}

Brand

 public class Brand
{
    [Key]
    public int brand_id { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    public string brandname { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    public string program { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    public string currency { get; set; } 
    public string note { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    [DataType(DataType.Date)]
    [DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
    public DateTime timestart { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    [DataType(DataType.Date)]
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd-MM-yyyy}")]
    public DateTime timeend { get; set; }

    public virtual List<Product> Products { get; set; } = new List<Product>();
}

Product

 public class Product
{

    [Key]
    public int product_id { get; set; }
    [ForeignKey("Brand")]
    public int brand_id { get; set; }
    public virtual Brand Brand { get; private set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    public string productname { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    public string condition { get; set; }
    [Required(ErrorMessage = "Nhập thiếu kìa fen.")]
    [Column(TypeName = "numeric")]
    public decimal rebate { get; set; } 
    public string note { get; set; }
}

I appreciate every help

quanhprx
  • 37
  • 9
  • 1
    Perhaps [this answer](https://stackoverflow.com/questions/29985150/visual-studio-during-debugging-the-function-evaluation-requires-all-threads-to) might help – Peter Smith Oct 12 '22 at 19:07
  • 2
    Are you trying to expand the results of _context.Brands from the Breakpoint? If so, no you cannot do that from in the debugger because that is an operation that needs to be sent to the database. Just F10 it and you can inspect the brands entity/proxy list that the operation returns. – Steve Py Oct 12 '22 at 21:53
  • thankyou guys i encounter a bug in my project and I thought that because of this problem turn out it just a feature in VS studio – quanhprx Oct 13 '22 at 02:14

0 Answers0