Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am getting the following error when I am debugging the application. It is giving me the Problem where I am using the EF collection, I am trying to see what's inside, then it gave an error, when I refreshed it and try to see next steps, this error popped-up, any help please to not to see this error at all?

Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation.


What I have tried:

I am searching in Google, and trying while debugging frequently
Posted
Updated 24-May-16 15:00pm
Comments
Philippe Mori 24-May-16 21:08pm    
Add additional information in the question. Be careful to properly use code block with the correct language set.

If you have a long running query the debugger times out before the query and reconstitution is finished. I have never found a way to get around this timeout, modify it, or turn it off.

I have found that there are certain things you cannot do with the debugger in the middle of an EF operation without running into this. I mitigated some of it by rewriting the code a bit to limit the number of items returned from the database.
 
Share this answer
 
Comments
[no name] 24-May-16 14:44pm    
No, its not a long query, its just a small table with 4 rows. And all I did was I stopped my execution there and tried to find what's there inside the object by using immediate window.

No EF before was not behaving like this I was using it before.

And here is my code:

My ASP.Net Controller is as below

namespace TestAngularJSApplication.Controllers
{
public class EmployeeController : Controller
{
public ActionResult Index()
{
return View();
}

public JsonResult GetEmployees()
{
DAL oDAL = new DAL();
//List<employee> listOfEmployees;
var a = oDAL.employees;
var listOfEmployees = oDAL.employees.ToList();
return Json(listOfEmployees,JsonRequestBehavior.AllowGet);
}
}
}


And my DAL is as below

public class DAL : DbContext
{
public DAL() : base("TestConnectionString") { }

public DbSet<employee> employees { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//base.OnModelCreating(modelBuilder);
modelBuilder.Entity<employee>().ToTable("EmployeeTable");
modelBuilder.Entity<employee>().HasKey(x => x.Id);
}
}
Dave Kreskowiak 24-May-16 16:27pm    
First, DAL is a bad name for a DbContext class. You can have multiple DbCOntexts in your application all looking at the same database, so it's better to call them exactly what they are.

Second, set the breakpoint on the "return Json..." line and you can look at the collection immediately above it.
Patrice T 24-May-16 19:14pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.
Philippe Mori 24-May-16 21:04pm    
Write your code in the question and use code block. Do you really believe someone would be enough crazy to read code that is not formatted? You are not helping yourself if you don't make minimal effort so that other might help you.
[no name] 24-May-16 16:46pm    
I will change the name of DAL class but I tried to check, the collection is not getting loaded. Table schema is also matching with the class members that I am mapping with.
Can you please help me

Here is my table structure
CREATE TABLE [dbo].[EmployeeTable](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](max) NULL,
[EmployeeAddress] [nvarchar](max) NULL,
[EmployeeSalary] [decimal](10, 2) NULL,
[IsActive] [bit] NULL,
CONSTRAINT [PK_EmployeeTable] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]



And here is my class structure
namespace TestAngularJSMCVApplication.Models
{
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public string EmployeeAddress { get; set; }
public decimal EmpployeeSalary { get; set; }
public bool IsActive { get; set; }
}
}

And here how I have written in DAL, any issues please Connection string is fine as its not throwing error in it and table has data but two rows has null values for the EmployeeAddress and EmployeeSalary, could that be a problem.

Here is how I am trying to retrieve values from Database table using DAL
public class DAL : DbContext
{
public DAL() : base("TestConnectionString") { }

public DbSet<employee> employees { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
//base.OnModelCreating(modelBuilder);
modelBuilder.Entity<employee>().ToTable("EmployeeTable");
modelBuilder.Entity<employee>().HasKey(x => x.Id);
}
}

Any ideas please?
In addition to the potential timeout issue there's also the possibility of a threading issue, because the debugger evaluation is being run on a separate thread. If your code that is being implicitly run by the debugger evaluation is not thread safe it can lead to this error as well.
Ref: debugging - "Function evaluation disabled because a previous function evaluation timed out." - in vs2012 - Stack Overflow[^]

If you can neither identify a timeout nor a threading issue then I suggest to resort to logging.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900