Question: Openmaple crash problem with C# program

When I use Openmaple with C#, if the command line involves "MapleEngine.StopMaple" or "restart", or the command line including "MapleEngine.EvalMapleStatement" is executed twice (sometimes more), it always cause a crash. Can anybody help me out with this problem? Thank you in advance!

The following is the crash report:

unhandled System.AccessViolationException
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=myprogram
  StackTrace:
       at myprogram.MapleEngine.EvalMapleStatement(IntPtr kv, Byte[] statement)
       at myprogram.programA.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Asus\My Documents\Visual  Studio files\myprogram\programA.aspx.cs:line 179
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at ASP.programA_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ea880c6e\8b71f093\App_Web_ibmxznhf.19.cs:line 0
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
       at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
       at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
       at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
       at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
       at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
       at Microsoft.VisualStudio.WebHost.Request.Process()
       at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
       at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
       at Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(Object acceptedSocket)
       at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
       at System.Threading.ThreadPoolWorkQueue.Dispatch()
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
  InnerException:

 

Jeff

Please Wait...