![]() |
#1 |
Участник
|
C# and AX Development:
Источник: http://olondono.blogspot.com/2007/12...-business.html
============== "Buffer overrun" using the COM Business Conector in C# (AX/Axapta) When you make consecutively logon and logoff, you will get an unexpected error: "Buffer overrun". That is because the COM Business Connector doesn't close the session with Axapta when you call the logoff method. So, to avoid this bug you must ensure releasing every COM object you use. Also, you must release the AXCom.dll library by yourself. 1. Call Marshal.ReleaseComObject for every object you have created including the AxaptaClass object. if (Marshal.IsComObject(custtable)) Marshal.ReleaseComObject(custtable); custtable = null; 2. Finally, after making logoff, release the AXCom.dll library manually: ApiWin32.CoFreeUnusedLibraries(); And here the ApiWin32 class: class ApiWin32 { [DllImport("ole32.dll")] public static extern void CoFreeUnusedLibraries(); } NOTE: For Visual Basic, declare the API as follows: Public Declare Sub CoFreeUnusedLibraries Lib "ole32.dll" () Источник: http://olondono.blogspot.com/2007/12...-business.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|