.netcore 3.1 升级 .net5 :The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.

1、将.csproj文件

<TargetFramework>net5.0</TargetFramework>

2、连接oracle,open时报错:The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.

.netcore 3.1 升级 .net5 :The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.

需要在.csproj文件添加:<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>

.netcore 3.1 升级 .net5 :The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.