runtime: System.Data.Odbc PlatformNotSupportedException

System.Data.Odbc v4.7.0 Platform: Windows Server 2019 version 1809 (build 17763.805) Runtime: .NET Core 3.1 (Library with odbc dependency is .NET Standard 2.1) Exception:

System.PlatformNotSupportedException: System.Data.ODBC is not supported on this platform.
   at System.Data.Odbc.OdbcConnection..ctor(String connectionString)
   at Connector.SysCfg.Odbc.OdbcSysCfgRepository..ctor(String dsnName) in D:\Sync\Repositories-Ipecon\paragon-platform\src\Connector.SysCfg\Odbc\OdbcSysCfgRepository.cs:line 28
...

Code:

mConnection = new OdbcConnection($"DSN={mDsnName};");

Additional info: Just migrated from .NET Framework 4.6.1 to .NET Core 3.1 on the same machine. OdbcConnection worked fine on .NET Framework 4.6.1. Application is x86.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 23 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@MicahKimel you should downgrade System.Data.Odbc to v6.0.1 https://github.com/dotnet/runtime/discussions/78550

I also encountered a similar problem The class library refers to odbc, and the console refers to the dll file, and it will prompt “System.Data.ODBC is not supported on this platform.”