C# Entity Framework 4 Common Language Runtime detected an invalid program error?

后端 未结 4 1798
遥遥无期
遥遥无期 2021-01-12 04:36

How do you debug/fix a \"Common Language Runtime detected an invalid program\" error? What exactly does it mean anyway?

I have a C# MVC 2 web app that can deployed t

4条回答
  •  青春惊慌失措
    2021-01-12 05:40

    Have you tried to deploy the beta config on another machine? Are your apppools setup to be the same (i.e., classic vs integrated, same .net version)? Have you tried cleaning the solution and redeploying to a new location? Have you tried deploying beta build to release location? (be sure to delete all files before publishing; im curious if theres a leftover dynamically loaded dependency that might be causing problems)

    UPDATE:

    Excellent wrt more information. On line 3, you are defining the variable page while also using a previously defined variable named page. How does that compile? Try commenting out that code or at least try it without the skip.

    NOTE: I think that the Count() followed by the Take() might be executing the query twice.

    NOTE2: I've only used the EntityFramework v4 Database First development, but I don't remember programming directly against the ObjectSet. Usually it's your entity class (e.g., MyContext.Orders)... Maybe there is something going on with programming against that object and setting a Decimal value. Are there any properties on the model for that property that make it non-standard?

提交回复
热议问题