Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQPad Query Error

Problem: Can't properly setup LINQPad connection to my Entity Framework dll.

  1. I downloaded LINQPad (v4.42.01)
  2. I started to create a new connection using the Entity Framework DbContext POCO driver
  3. At the setup dialog I pointed to my C# project's dll and it found the appropriate DbContext class.
  4. Next I pointed the config file to the app.config of my C# project
  5. When I hit the Test Button I get this error:

Error: The type initializer for 'System.Data.Entity.Internal.AppConfig' thre an exception. An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' on one of its dependencies. The system cannot find the file specified. (C:\Code\NET\FTI_Opp_Model\App.Config line 5)

So I tried doing what @Sorax did in this related question and moved my EntityFramework.dll from the one I got from NuGet in my project into the LINQPad.exe folder. This got me a little further along and the Test now worked. I was encouraged because my connection in the LINQPad panel showed all my entities underneath it.

But when I right click on my Borrower entity and chose "Borrower.Take(100)" I received this error from LINQPad:

The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.

With an inner exception message:

[A]System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection cannot be cast to [B]System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection. Type A originates from 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'Default' at location 'C:\MarkSisson\LinqPad\EntityFramework.dll'. Type B originates from 'EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadFrom' at location 'C:\Users\msisson\AppData\Local\Temp\LINQPad\vlnebssu\shadow_ujjvzp\EntityFramework.dll'.

Any ideas?

like image 635
sisdog Avatar asked Aug 31 '26 09:08

sisdog


1 Answers

Download the latest beta - this problem was fixed in 4.42.05.

like image 128
Joe Albahari Avatar answered Sep 04 '26 07:09

Joe Albahari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!