I had a problem in an ASP.NET C # MVC project that we are doing.
We are using the .NET Framework 4.0 for development, and I recently updated my Visual Studio to 2012 (everyone else uses 2010), and now it has stopped working. Now in some places I get the error:
Operation could destabilize the runtime.
I found some people saying that this is due to installing .NET 4.5 with Visual Studio 2012, but I have not yet found a solution for my problem. The line in the code she complains about is as follows:
var companyModel = from c in db.Company select c; return View(companyModel.ToPagedList(page, 10));
What is wrong with this code? companyModel will become
System.Linq.IQueryable<Company>
I tried adding
companyModel.OfType<Company>();
Between these two lines, but it didnโt work either (idea from Operation can destabilize runtime? )
Everything works fine with Visual Studio 2010. Thank you!
source share