私の c# プログラムは Matlab dll を使用しており、デバッグ モードで実行している限り機能します。しかし、リリースモードで実行しようとすると、インスタンスを作成するとすぐにクラッシュします。
TypeInitializationException をスローします。
ご協力いただきありがとうございます
スタックトレース:
"at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Turbo_Neuron.ANNController..ctor()
in C:\\Users\\Eli\\Desktop\\....\\MyProject\\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()"
そしてそれは言います:
The type initializer for 'MatlabANNComp.MatlabANN' threw an exception.
スタックトレース 2:
at MatlabANNComp.MatlabANN..ctor()
at Turbo_Neuron.ANNController..ctor() in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\Matlab_Layer\ANNController.cs:line 49
at Turbo_Neuron.TNController..ctor(pnl_main form) in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\Logic_Layer\TNController.cs:line 49
at Turbo_Neuron.pnl_main..ctor() in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\View_Layer\Turbo_Form.cs:line 29
at Turbo_Neuron.Program.Main() in C:\Users\Eli\Desktop\Work_ANN\ANN\working\Current\Turbo_Neuron_Pro_Filxed_10.09.13_N\Turbo_Neuron\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
例外メッセージ:
Exception.Message =
"The type initializer for 'MatlabANNComp.MatlabANN' threw an exception."
InnerException.Message =
{"Could not load file or assembly 'MWArray, Version=2.10.1.0,
Culture=neutral, PublicKeyToken=e1d84a0da19db86f'
or one of its dependencies. An attempt was made
to load a program with an incorrect format."}
InnerException.InnerException = null