EDApplicationException in LinqPad with LinqConnect

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Sat 22 Sep 2018 17:05

We cannot reproduce the issue. Please upgrade to the newest (7.11.1229) build of dotConnect for PostgreSQL.
ssnz wrote: Thu 06 Sep 2018 01:07I installed 7.11.1216 and the existing connection no longer worked. I deleted the connection and created a new one, using the "build data context automatically" option. The installed version of the driver now shows as 4.8.1553.0. On right clicking a table and selecting table_name.Count() I observe the error:
LinqCommandExecutionException: Error on opening DbConnection.
There should be the inner exception that explains the reason of the problem. Please specify a detailed stack trace of the error. If LINQPad hides the inner exception, obtain it by attaching to LINQPad from Visual Studio (via Debug > Attach to Proccess). Before debugging, make these settings in your Visual Studio:
* in the (Debug > Windows > Exception Settings) window, select Common Language Runtime Exceptions
* in the (Tools > Options) window, navigate to Debugging > General and clear Enable Just My Code

ssnz
Posts: 19
Joined: Mon 20 Aug 2018 21:15

Re: EDApplicationException in LinqPad with LinqConnect

Post by ssnz » Wed 26 Sep 2018 00:25

Hi Shalex

I couldn't see the exception details in LinqPad so I used the debugger in VS which trapped the exception. Here are some of the details that seemed more informative. Is there anything else you need to see?

($exception).Source
mscorlib

($exception).FileName
Devart.Data.Linq

($exception).InnerException
null

($exception).Message
Could not load file or assembly 'Devart.Data.Linq' or one of its dependencies. The system cannot find the file specified.

($exception).StackTrace
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

($exception)._fusionLog
=== Pre-bind state information ===
LOG: DisplayName = Devart.Data.Linq
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Devart.Data.Linq | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)
LOG: Initial PrivatePath = NULL
Calling assembly : EntityDeveloper.LinqPad.LinqConnectDriver, Version=6.3.569.0, Culture=neutral, PublicKeyToken=09af7300eec23701.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\LINQPad5\LINQPad.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq.DLL.
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq/Devart.Data.Linq.DLL.
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq.EXE.
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq/Devart.Data.Linq.EXE.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Wed 26 Sep 2018 15:06

Please upgrade to v7.11.1229. In my case, LINQPad loads the Devart.* assemblies from these locations:
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data\5.0.2021.0__09af7300eec23701\Devart.Data.dll
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.Linq.dll
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql\7.11.1229.0__09af7300eec23701\Devart.Data.PostgreSql.dll
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.PostgreSql.Linq.dll
Make sure (via some file manager like https://x-diesel.com/ ) that the same Devart.* assemblies exist on your workstation on the same paths.

ssnz
Posts: 19
Joined: Mon 20 Aug 2018 21:15

Re: EDApplicationException in LinqPad with LinqConnect

Post by ssnz » Thu 27 Sep 2018 01:58

Hi Shalex

Thanks again for the time you're spending on this.

I have:
* uninstalled dotconnect
* uninstalled linqpad
* deleted any stray linqpad files
* used Unreal Commander to delete stray Devart directories in GAC_MSIL that held old versions

then I
* installed dotconnect 7.11.1229.0
* installed Linqpad
* added the devart driver by navigating to the .lpx file.
* added a new connection to my local DB

As before,
* the connection test is passed
* the list of tables is correctly populated.
* the table.Count() still generates the LinqCommandExecutionException: Error on opening DbConnection.


I also note that:
* the assemblies you described above are exactly the same in my GAC_MSIL directory
* I have no file C:\Program Files (x86)\LINQPad5\LINQPad.config. Should I? If so, what should it look like?
* how can I check where LinqPad looks for these assemblies?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Fri 28 Sep 2018 16:01

1. Run your LinqPad 5 via right click > Run as administrator. Does this help?

2. Confirm that
"C:\Users\garet\AppData\Local\LINQPad\Drivers\DataContext\4.6\EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)\EntityDeveloper.LinqPad.LinqConnectDriver.dll"
of the 6.3.582.0 version (Properties > Details > Product version) was created on your computer after adding LinqConnectDriver.lpx to your LINQPad.

3. Open Windows Task Manager and make sure that LINQPad is running in the x86 mode (its name should be "LINQPad 5 (32 bit)").

4. Attach to LINQPad with Visual Studio again, call table.Count() to produce the "Could not load file or assembly 'Devart.Data.Linq' or one of its dependencies." error, navigate to Debug > Windows > Modules, sort by Name and specify the paths of all Devart.* and EntityDeveloper.* assemblies loaded in the process.

JIC: in my case they are
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data\5.0.2021.0__09af7300eec23701\Devart.Data.dll
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.Linq.dll
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql\7.11.1229.0__09af7300eec23701\Devart.Data.PostgreSql.dll
  • C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.PostgreSql.Linq.dll
  • C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\Devart.Shell.Interfaces.ED.dll
  • C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\NET4\EntityDeveloper.Common.dll
  • C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\NET4\EntityDeveloper.exe
  • C:\Users\alexsh\AppData\Local\LINQPad\Drivers\DataContext\4.6\EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)\EntityDeveloper.LinqPad.LinqConnectDriver.dll

ssnz
Posts: 19
Joined: Mon 20 Aug 2018 21:15

Re: EDApplicationException in LinqPad with LinqConnect

Post by ssnz » Mon 01 Oct 2018 02:38

1) Administrator mode: no difference
2) It is version 6.3.582.0
3) Linqpad is running in x86 mode.
4) Here are mine (identical to yours):

C:\WINDOWS\assembly\GAC_MSIL\Devart.Data\5.0.2021.0__09af7300eec23701\Devart.Data.dll
C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.Linq.dll
C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql\7.11.1229.0__09af7300eec23701\Devart.Data.PostgreSql.dll
C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.PostgreSql.Linq.dll
C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\Devart.Shell.Interfaces.ED.dll
C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\NET4\EntityDeveloper.Common.dll
C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\NET4\EntityDeveloper.exe
C:\Users\garet\AppData\Local\LINQPad\Drivers\DataContext\4.6\EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)\EntityDeveloper.LinqPad.LinqConnectDriver.dll

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Mon 01 Oct 2018 11:28

Taking into account the fact that all needed Devart.* and EntityDeveloper.* assemblies are loaded in the process of LINQPad, it is not clear why you are getting "Could not load file or assembly 'Devart.Data.Linq' or one of its dependencies.".

Maybe, the error is different now? Please check the most inner exception in debug with Visual Studio.

ssnz
Posts: 19
Joined: Mon 20 Aug 2018 21:15

Re: EDApplicationException in LinqPad with LinqConnect

Post by ssnz » Mon 01 Oct 2018 21:49

No obvious change there.

I have just reinstalled dotconnect 7.11.1202 and that works for me. 7.11.1229 still doesn't work.

So a recent change has caused this issue but resolved others

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Tue 09 Oct 2018 10:44

ssnz wrote: Mon 01 Oct 2018 21:497.11.1229 still doesn't work.
Please check the most inner exception in debug with Visual Studio. Maybe, the error is different now?

ssnz
Posts: 19
Joined: Mon 20 Aug 2018 21:15

Re: EDApplicationException in LinqPad with LinqConnect

Post by ssnz » Thu 18 Oct 2018 20:58

HI Shalex

No change. the inner exception is still null.

Gareth

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Tue 23 Oct 2018 13:44

ssnz wrote: Wed 26 Sep 2018 00:25LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq.DLL.
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq/Devart.Data.Linq.DLL.
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq.EXE.
LOG: Attempting download of new URL file:///C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/Devart.Data.Linq/Devart.Data.Linq.EXE.
Try copying all these assemblies

C:\WINDOWS\assembly\GAC_MSIL\Devart.Data\5.0.2021.0__09af7300eec23701\Devart.Data.dll
C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.Linq.dll
C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql\7.11.1229.0__09af7300eec23701\Devart.Data.PostgreSql.dll
C:\WINDOWS\assembly\GAC_MSIL\Devart.Data.PostgreSql.Linq\4.8.1566.0__09af7300eec23701\Devart.Data.PostgreSql.Linq.dll
C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\Devart.Shell.Interfaces.ED.dll
C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\NET4\EntityDeveloper.Common.dll
C:\Program Files (x86)\Common Files\Devart\EntityDeveloper\NET4\EntityDeveloper.exe

to

C:/Users/garet/AppData/Local/LINQPad/Drivers/DataContext/4.6/EntityDeveloper.LinqPad.LinqConnectDriver (09af7300eec23701)/ .

Does this help? If not, specify the full stack trace of your current exception again (obtain it via debug in Visual Studio).

ssnz
Posts: 19
Joined: Mon 20 Aug 2018 21:15

Re: EDApplicationException in LinqPad with LinqConnect

Post by ssnz » Mon 19 Nov 2018 21:53

Hi Shalex

Progress. I copied the files and performed debugging as you suggested and this revealed the issue.

When setting up the connection, if "Allow saving password" is not checked then the problem occurs.

Checking this box fixes the issue, but comes at the cost of having our DB password in clear text in the ConnectionsV2.xml file in my roaming folder.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDApplicationException in LinqPad with LinqConnect

Post by Shalex » Fri 23 Nov 2018 19:23

ssnz wrote: Mon 19 Nov 2018 21:53When setting up the connection, if "Allow saving password" is not checked then the problem occurs.
1. Are you getting the same "Could not load file or assembly 'Devart.Data.Linq' or one of its dependencies." exception? Please check the most inner exception in debug with Visual Studio.
ssnz wrote: Mon 19 Nov 2018 21:53Checking this box fixes the issue, but comes at the cost of having our DB password in clear text in the ConnectionsV2.xml file in my roaming folder.
2. Specify the full path to your ConnectionsV2.xml. Most likely, this is the way how LINQPad works.

Post Reply