I am using the Accpac.Advantage dlls to communicate from a third party .net app into Sage 300. The processes we are doing are simply to open a connection and then return various pieces of information from view calls (I use the CS query view through an Accpac.Advantage.Session object. This works fine for many calls but periodically it seems that this process fails and as a result crashes the calling application as well. After the failure, I can turn right around and process the exact same thing a subsequent time and it succeeds. When it crashes, in the event log I see something like this (which given that the exact same flow can work several times in a row successfully I am somewhat stumped.
Application: MySageIntegrationApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at AccpacCOMSVR.AccpacSvrViewClass.Close()
at ACCPAC.Advantage.Server.View.Dispose()
at ACCPAC.Advantage.View.Finalize()
I wondered if anyone else had seen anything else that might resemble this or if there were any suggestions of what could be happening. As a note, I have seen this in a couple different instances both 2018 and 2019. Note that I have not tried enough to say I do or do not see it on other versions. Again, simply restarting the app allows the same exact flow to succeed.