0
$\begingroup$

I have a program, which used NETlink to call Mathematica functions from C#. When we compile this program with .NET 4.0 or higher we get "An unhandled exception of type 'System.AccessViolationException' occurred in Wolfram.NETLink.dll"

And trace here:

System.AccessViolationException was unhandled HResult=-2147467261 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=Wolfram.NETLink StackTrace: at Wolfram.NETLink.Internal.Win64MathLinkAPIProvider.MLNextPacket(IntPtr link) at Wolfram.NETLink.Internal.Win64MathLinkAPIProvider.extMLNextPacket(IntPtr link) at Wolfram.NETLink.Internal.NativeLink.NextPacket() at Wolfram.NETLink.WrappedKernelLink.NextPacket() at Wolfram.NETLink.KernelLinkImpl.WaitForAnswer() at Wolfram.NETLink.MathKernel.Compute()

Any thoughts?

$\endgroup$
1
  • $\begingroup$ If you want help with this please edit your question and provide a bare bones/cut down example of the Mathematica code and the C# calling code. A [mcve] is required to reproduce the problem to apply troubleshooting and diagnose the root cause. $\endgroup$
    – WolframFan
    Aug 31, 2016 at 10:59

1 Answer 1

2
$\begingroup$

AccessViolationException is explicit : somehow your program is accessing memory that it doesn't have right to access (didn't allocate for ex).

Since it' s in the another library, you're probably passing bad arguments to the .NETLink . or (less likely) the library contains a bug ...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.