-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET 5.0 published winforms application return System.BadImageFormatException on db access #2617
Comments
Question: Have you made a direct dependency on System.Data.SqlClient? If not, what happens if you do? |
Yes, I've made direct dependency on System.Data.SqlClient, because without System.Data.SqlClient I see errors even on debug:
|
Which version of System.Data.SqlClient? I see 4.4.0 in the event log note above. Are you using 4.8.2 nuget package? (I know that the version numbers don't always match between the dll/sni version and the nuget version, and I haven't looked, so I'm asking.) |
System.Data.SqlClient 4.8.2 version |
I just created a quick dummy app to verify. After publishing, it worked fine for me. If you want, I can upload to GH so you can see if it works for you. One thing you might check, under the publish directory, do you see |
Yes, it would be helpful, thanks!
No, it's not in my publish directory |
Download this repo here: https://github.com/viceroypenguin/l2db-publish-net50 If that doesn't work, then there's a problem with the build/publish system on your machine; I'd suggest a repair of Visual Studio/reinstall of .net5.0 If that does work, then there's a dependency management problem. Try restoring packages? Or open the package manager console and execute |
Thanks!
|
That sounds like a bug either in CO or in System.Data.SqlClient. I'd report upstream to dotnet/runtime and see if they have any ideas. You might try switching to Microsoft.Data.SqlClient. It is the newer path, and they'll likely suggest doing the same. To bind w/ l2db, you can use SqlServerTools.GetDataProvider(
SqlServerVersion.v2017, // or whichever version of server you're currently using
SqlServerProvider.MicrosoftDataSqlClient to get a DataProvider, and pass the connection string as the second argument. Should require no other changes to l2db. |
@viceroypenguin thanks for your help, I'll check Microsoft.Data.SqlClient. |
Glad to help how I can! I'm sure we'll see plenty of these friction bugs over the next couple months. Hopefully they won't take too long to wash out. |
Same for Microsoft.Data.SqlClient:
|
Darn. Sorry! Hope MSFT resolves it for ya quickly. |
After updating winforms core 3.1 app with linq2db reference to net5.0 (need the ability to deploy through clickonce) and publishing to folder (without clickonce) and after running that app I see
System.BadImageFormatException
on any db access.All db queries works when on debug.
db: MSSQL
linq2db version: 3.1.6
publish target framework: net5.0-windows
target runtime: win-x64 and win-x86 - reproduced for both
stacktrace:
Also, when I've published that app via clickonce, installing it and trying to start I see the following entry in the Windows Application Event Log after crash:
The text was updated successfully, but these errors were encountered: