Operation could destabilize the runtime?

前端 未结 11 1584
执念已碎
执念已碎 2020-11-28 09:31

I\'m having a little bit of trouble understanding what the problem is here. I have a bit of code that pulls records from a database using LINQ and puts them into an object

11条回答
  •  悲&欢浪女
    2020-11-28 10:10

    I came across this error with similar code;

    IEnumerable records = (from t in db.Tables
                                  where t.Id.Equals(1)
                                  select t).ToList();
    

    This seemingly harmless code was part of a UserControl method which was called from a Page. No problem in a .NET4 development environment, however, when the site was PreCompiled and deployed to the server on .NET3.5 I got this error.

    I suspect this has something to do with the fact that the control was being compiled into a separate DLL combined with the security changes between the frameworks as described in this .NET security blog

    My solution: run the live site on .NET4

    提交回复
    热议问题