AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.12.2007, 20:35   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
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, напишите личное сообщение администратору.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 04:21.