I’m having a problem in an ASP.NET C# MVC project that we’re doing.
We’re using .NET Framework 4.0 for the development, and recently I upgraded my Visual Studio to 2012 (everyone else is using 2010), and now it stopped working. Now in some places I get the error:
Operation could destabilize the runtime.
I’ve found some people saying that this has to do with .NET 4.5 being installed with Visual Studio 2012, but I didnt find a solution for my problem yet. The line in code it complains about looks like this:
var companyModel = from c in db.Company select c;
return View(companyModel.ToPagedList(page, 10));
Whats wrong about this code? companyModel become a
System.Linq.IQueryable<Company>
I tried adding
companyModel.OfType<Company>();
Between these 2 lines, but it didnt work either (idea from Operation could destabilize the runtime?)
Everything works just fine with Visual Studio 2010. Thanks!
Get the latest version of PagedList, that should fix it. I had the same problem.