Linqpad6 loads same assembly twice, leading to type1 != type1 issues
Trying to migrate driver to linqpad6 and have issue with same assembly loaded twice, which leads to errors with reflection code. See attached screen.
Same System.Data.Common.dll loaded twice (same name, version, path) with second load right after dirver assembly.
We don't load this assembly explicitly and I don't even have time to intercept load - it is already loaded second time in driver class static constructor.
Any ideas/suggestions what's going on and how to fix it?
Comments
Can you post the .csproj file for your driver?
Or if you're able, can you check your driver into a public repository so I can take a look at the whole thing?
Sure. Just create firebird or access oledb connection and try to expand db node (no real connection string required as it fails earlier).
E.g. access
or firebird
access ODBC provider works, as it doesn't use failing funtionality
Source code : https://github.com/linq2db/linq2db.LINQPad/pull/32
just build project and it will generate lpx files in project root
OK, I've got the project and modified the .csproj so that it copies the output to a folder where LINQPad can load it:
and added DevDeploy6.bat:
It now builds and I can use the driver in LINQPad. I've chosen 'Firebird' as the database driver. What should I type into the connection string box to reproduce the error?
It actually doesn't matter, as it fails before connection string used, but format is like
DataSource=localhost;Database=TESTDB25.FDB;User Id=SYSDBA;Password=masterkey
Remove this line from your GetAssembliesToAdd method:
The IDbConnection type is part of the .NET Core Framework which is automatically referenced. If you reference it again, it will assume it's a non-core assembly and will resolve it to the user ALC.
Whoops... sorry for that. Now I'm getting
will check what else wrong
Sounds like you're trying to compile without the whole FX. This is what I do in the EF Core driver:
Thanks! Now it's working!
Terrific. Let me know when you upload the driver to NuGet and I'll add it to the 'featured' tab.
Released: https://www.nuget.org/packages/linq2db.LINQPad / https://github.com/linq2db/linq2db.LINQPad/releases/tag/v3.0.0 (release notes link in nuget borken, will be fixed in next version)
BTW, I have one suggestion and question: