Closed maximpashuk closed 6 years ago
That would be great if possible.
Do you know if x64 IBM.Data.*.dll
and if yes where can we get them?
You know, I am not using DB2 at all. Exception I get thrown when I want to connect to MS SQL Server.
But I googled a link http://www-01.ibm.com/support/docview.wss?rs=4020&uid=swg27016878
Hope this helps.
I can see that client libraries used in linq2db is outdated (version 9.7 used, but current is 11.1). I think core lin2db project should be updated to support both x86 and x64 versions.
As for me, I am not sure should linq2db support DB2 at all.
Thanks a lot!
I just came across this issue. My suggestion is to allow the linqpad driver to function when provider dlls are missing so that the ones we can delete the ones we dont need.
Any update on this please?
In next versions we'll switch off loading x86 providers in 64 bit environment. For now I can only suggest not using Any CPU build :(
okay, sounds good. Any idea when the next version will be out?
Unfortunately, the fix that you did Igor is not really working (see screenshot below). The problem still exists with the change in the screenshot because the check is done in the runtime, while the BadImageFormatException happens during the assembly loading and binding. Unfortunately, the only real fix for LINQPad AnyCPU on 64 bit OS is to remove all references to the offending assemblies (DB2, Informix and Oracle Native).
I did it and it works after rebuild. Just in case you want to incorporate the changes Igor, I'm also attaching the diff file.
Unfortunately we need more clever solution with dynamic assembly loading.
a try catch around does not help?
Project has references, so libraries will be loaded automatically. And proposed solution just removes a lot of providers that do not support x64 mode.
Are the Librarys only referenced or are they also used?
The libraries are referenced and hence are automatically loaded by .NET Fusion (assembly loading code).
There is no clever solution unfortunately unless you want to resort to dynamic assembly loading and wrapping their types. The alternative is rather to produce 2 builds of plugin for x86 and x64 platforms with preprocessor conditions removing the offending pieces of code.
It is not too hard to load assemblies dynamically. But i have not time do do that right now.
It's not hard, but you'd need to re-wrap every single class from them in your custom loader. It's just going to be a pain in the neck.
The other alternative could be to host the main plugin entry point in the new dll which would hook up to the AppDomain.CurrentDomain.AssemblyResolve event and would suppress the exception on 64 bit OS. It would then need to hide those specific providers from the UI as well.
Also, for anyone else looking for the plugin which would work on 64 bit OS - here's the build that works for me. linq2db.LINQPad.zip
Working on version that loads data providers dynamically, expect this after 2.0 release.
Fixed in #11
Windows 10 64-bit.
If using LINQPad 5 - linq2db plugin works fine. if using LINQPad 5 AnyCPU - linq2db plugin throws exception
I think this happens because IBM.Data.DB2.dll has platform target x86 If I open IBM.Data.DB2.dll from Redist folder in this repositiry in JetBrains dotPeek, I can see picture
So I think linq2db plugin should provide two versions on IBM.Data.DB2.dll - x86 and x64 bit editions. You can do this using bindingRedirect feature.