-
Notifications
You must be signed in to change notification settings - Fork 191
Closed
Description
Steps to repro.
mkdir Trimmed && cd Trimmed
dotnet new console
dotnet add package Oracle.ManagedDataAccess.Core --version 2.19.60
- Replace Program.cs with the following code.
using System; using Oracle.ManagedDataAccess.Client; namespace Trimmed { class Program { static void Main(string[] args) { string connectionString = "connection string for Oracle DB"; using (OracleConnection con = new OracleConnection(connectionString)) { using (OracleCommand cmd = con.CreateCommand()) { try { con.Open(); cmd.BindByName = true; cmd.CommandText = "select id from test_table where id = :id"; OracleParameter id = new OracleParameter("id", "test"); cmd.Parameters.Add(id); OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Console.WriteLine("id: " + reader.GetString(0)); } Console.WriteLine(); Console.WriteLine("Press 'Enter' to continue"); reader.Dispose(); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); } } } } }
dotnet publish -c Release --runtime win-x64 /p:PublishTrimmed=true
.\bin\Release\netcoreapp3.1\win-x64\publish\Trimmed.exe
Error
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.TypeInitializationException: The type initializer for 'OracleInternal.ServiceObjects.OracleConnectionImpl' threw an exception.
---> System.TypeInitializationException: The type initializer for 'Oracle.ManagedDataAccess.Types.TimeStamp' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Runtime.Serialization.Formatters.Binary.Converter' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 指定されたファイルが見つかりません。
File name: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Runtime.Serialization.Formatters.Binary.Converter..cctor()
--- End of inner exception stack trace ---
at OracleInternal.Common.OracleTimeZone.GetInstance()
at Oracle.ManagedDataAccess.Types.TimeStamp..cctor()
--- End of inner exception stack trace ---
at Oracle.ManagedDataAccess.Types.TimeStamp.InitializelatestTZversion()
at OracleInternal.ServiceObjects.OracleConnectionImpl..cctor()
--- End of inner exception stack trace ---
at OracleInternal.ServiceObjects.OracleConnectionImpl..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance[T]()
at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, OracleConnection connRefForCriteria, String instanceName, List`1 switchFailedInstNames)
at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, OracleConnection connRefForCriteria, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, OracleConnection connRefForCriteria)
at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
at Trimmed.Program.Main(String[] args)
Metadata
Metadata
Assignees
Labels
No labels