We are developing an Add-On using Business One Studio for Microsoft Visual Studio. We have added several System Forms into the solution using SAP Business One Installed Templates.
We have custom c# code that we execute at different events on these forms (this.DataAddBefore, this.DataUpdateAfter etc). We then create the .ard file with AddOnRegDataGen.exe and deploy the Add-On. All seems well, until we click the Preview icon on a marketing document.
Then our Add-On immediately crashes with the following SAP System Message:
This does not occur for any of the marketing documents that have not been added into our Add-On solution. We have double checked our code to be sure we're catching all exceptions. We have also used DebugDiag 2 to listen to the process while it crashes. That has given us two interesting exceptions:
Unable to cast COM object of type 'SAPbouiCOM.PrintEventInfoClass' to interface type 'SAPbouiCOM.IPrintEventInfo'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{EF8A2329-3D49-4136-9DEB-F1CB1E27DC18}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
and
Object of type 'SAPbouiCOM.ReportDataInfoClass' cannot be converted to type 'SAPbouiCOM.PrintEventInfo&'.
We have tried building the Add-On for Any CPU as well as x86 but the error still occurs.
We are running SAP B1 9.00.059 PL: 7
Has anyone had this issue of the Print Layout crashing your Business One Studio Add-On?
Thank You!!