QuantLib C# error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

QuantLib C# error

simone pilozzi
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
Reply | Threaded
Open this post in threaded view
|

Re: QuantLib C# error

letian
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
Reply | Threaded
Open this post in threaded view
|

Re: QuantLib C# error

simone pilozzi
Thanks for that Letian,
finally it looks like a matter of platform : I have an x64 unit while the projects looks to be set for an x86. I loaded the already compiled x64 boost  binaries,compiled the NQuanLib and changed the platform reference for the examples and they seem working.
Many Thanks for that


On 30 April 2014 02:06, letian wang <[hidden email]> wrote:
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=-<a href="tel:2146233036" target="_blank" value="+12146233036">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=-<a href="tel:2146233036" target="_blank" value="+12146233036">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=-<a href="tel:2146233052" target="_blank" value="+12146233052">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




------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users