I am attempting to open an Imanage document, in MS Word, within a temporary test application (for debugging) to later copy over into an ActiveX control project. The error that is popping up is:
Exception thrown at 0x7618851A (msvcrt.dll) in w3wp.exe: 0xC0000005: Access >violation reading location 0x09801000.
If there is a handler for this exception, the program may be safely continued.
The error occurs when running the cmd.Execute line and I am unsure as to why I am getting the error.
    using IManage;
    using IMANEXTLib;
    using System;        
        namespace WebApplication3
        {
            public partial class WebForm2 : System.Web.UI.Page
            {
                IManDatabase imanagedatabase;
                IManDMS myDMS = new ManDMSClass();
        
                protected void Page_Load(object sender, EventArgs e)
                {
                    openImanageDoc("docNumber", "versionNumber", "server", "database", ReadOnly);
                }
                public void imanageLogin(string server, string database)
                {
                    try
                    {
                        IManSession session = myDMS.Sessions.Add(server);
                        IManWorkArea oWorkArea = session.WorkArea;
                        session.TrustedLogin();
        
                        foreach (IManDatabase dbase in session.Databases)
                        {
                            if (dbase.Name == database)
                            {
                                imanagedatabase = dbase;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
        
                public void openImanageDoc(string docNo, string versionNo, string server, string database, bool isReadOnly = true)
                {
                    IManDocument doc;
                    try
                    {
                        imanageLogin(server, database);
                        int iDocNo = int.Parse(docNo);
                        int iVersion = int.Parse(versionNo);
                        doc = imanagedatabase.GetDocument(iDocNo, iVersion);
                        openNRTDocument(ref doc, isReadOnly);
                        imanagedatabase.Session.Logout();
                        myDMS.Close();
                    }
                    catch (Exception Ex)
                    {
                        imanagedatabase.Session.Logout();
                        throw Ex;
                    }
                    finally
                    {
                        imanagedatabase = null;
                        myDMS = null;
        
                    }
                }
        
        
                public void openNRTDocument(ref IManDocument nrtDocument, Boolean isReadonly)
                {
                    OpenCmd cmd = new OpenCmd();
                    ContextItems objContextItems = new ContextItems();
        
        
                    objContextItems.Add("NRTDMS", myDMS);
                    objContextItems.Add("SelectedNRTDocuments", new[] { (NRTDocument)nrtDocument.LatestVersion });
                    objContextItems.Add("IManExt.OpenCmd.Integration", false);
                    objContextItems.Add("IManExt.OpenCmd.NoCmdUI", true);
        
                    cmd.Initialize(objContextItems);
                    cmd.Update();
                    cmd.Execute();
        
                }
            }
        }
Due to the nature of the error, I am presuming it is a configuration issue rather than a code error although I could be completely wrong as I am very new to programming.
I have found out that w3wp.exe is an IIS worker process created by the app pool but other than that I have no idea what the numeric code represents. Any help or advice is greatly appreciated.