Re: QuantLib C# error

Posted by letian on
URL: http://quantlib.414.s1.nabble.com/QuantLib-C-error-tp15219p15221.html

Adding NetFx40_PInvokeStackResilience attribute into config should solve this issue.  

Letian
Le mardi 29 avril 2014 10h08, simone pilozzi <[hidden email]> a écrit :
Dear Users,
I downloaded QuantLib Swig Bindings from
 
and successfully compiled NQuantLib_vc10 and the two examples (EquityOption and BermudanSwaption)
 
I then ran  EquityOption.exe that thrown an exception at the moment of instatntiating the QuantLib Date :
Date todaysDate = new Date(15, Month.May, 1998);
The exception is the following:
 
System.TypeInitializationException was unhandled
  HResult=-2146233036
  Message=The type initializer for 'QuantLib.NQuantLibcPINVOKE' threw an exception.
  Source=NQuantLib
  TypeName=QuantLib.NQuantLibcPINVOKE
  StackTrace:
       at QuantLib.NQuantLibcPINVOKE.new_Date__SWIG_1(Int32 jarg1, Int32 jarg2, Int32 jarg3)
       at QuantLib.Date..ctor(Int32 d, Month m, Int32 y) in V:\Risk\QuantLib-SWIG-1.1\CSharp\csharp\Date.cs:line 48
       at BermudanSwaption.Run.Main(String[] args) in V:\Risk\QuantLib-SWIG-1.1\CSharp\examples\BermudanSwaption.cs:line 72
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       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()
  InnerException: System.TypeInitializationException
       HResult=-2146233036
       Message=The type initializer for 'SWIGExceptionHelper' threw an exception.
       Source=NQuantLib
       TypeName=SWIGExceptionHelper
       StackTrace:
            at QuantLib.NQuantLibcPINVOKE.SWIGExceptionHelper..ctor()
            at QuantLib.NQuantLibcPINVOKE..cctor() in V:\Risk\QuantLib-SWIG-1.1\CSharp\csharp\NQuantLibcPINVOKE.cs:line 126
       InnerException: System.DllNotFoundException
            HResult=-2146233052
            Message=Unable to load DLL 'NQuantLibc': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
            Source=NQuantLib
            TypeName=""
            StackTrace:
                 at QuantLib.NQuantLibcPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_NQuantLibc(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidCastDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
                 at QuantLib.NQuantLibcPINVOKE.SWIGExceptionHelper..cctor() in V:\Risk\QuantLib-SWIG-1.1\CSharp\csharp\NQuantLibcPINVOKE.cs:line 106
            InnerException:
 
Does anyone have any idea ?
Many Thanks in advance

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users