MFC编写DLL 32位Release 出现 debug Assertion Failed,该怎么处理
MFC编写DLL 32位Release 出现 debug Assertion Failed
编写的是一个二次开发的DLL,64们Release版本没有问题,转到32位先调试成debug版本报这些错误,后来又转为32位的Release版本,还是报这个错误,我感觉是我的代码有问题,小僧已经没有分了,只有这20分,不好意思,请大侠们帮忙看一下,谢谢:
我用的附加调试程序试过,点重试和中止,程序都会直接退出,调不出堆栈,点忽略程序居然还能继续使用
出错部分代码如下:
CClientSocket 类代码:
图片1
图片2
图片3
图1图2出错相关代码:
图3出错相关代码:
编写的是一个二次开发的DLL,64们Release版本没有问题,转到32位先调试成debug版本报这些错误,后来又转为32位的Release版本,还是报这个错误,我感觉是我的代码有问题,小僧已经没有分了,只有这20分,不好意思,请大侠们帮忙看一下,谢谢:
我用的附加调试程序试过,点重试和中止,程序都会直接退出,调不出堆栈,点忽略程序居然还能继续使用
出错部分代码如下:
bool LinkLicenseServer()
{
if(!AfxSocketInit())
{
AfxMessageBox(L"Error 201:Socket Initial Failed!");
return false;
}
CClientSocket *clientSocket;
clientSocket = new CClientSocket();
clientSocket->AsyncSelect(FD_READ|FD_WRITE|FD_OOB); //在此弹出图片1和2
CString m_strServer=LicenseIP;
long licport = _wtol(LicensePort);
if(!clientSocket->Create()) //在此第三张图片弹出两遍
{
::AfxMessageBox(L"Error 202:Connect to the License server failed!");
return false;
}
if(!clientSocket.Connect(m_strServer,licport))
{
::AfxMessageBox(L"Error 203:Connect to the License server failed!");
return false;
}
......
}
CClientSocket 类代码:
#include "StdAfx.h"
#include "ClientSocket.h"
#include "tagHeader.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CClientSocket::CClientSocket(void)
{
}
CClientSocket::~CClientSocket(void)
{
}
void CClientSocket::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
CString Msg;
char buff[1000];
memset(buff,0,sizeof(buff));
Receive(buff, sizeof(buff),2);
Msg =CString(buff).Mid(1);
long t1=GetTickCount();
while(Msg.GetLength()!=buff[0])
{
long t2=GetTickCount();
if((t2-t1)/1000>5)
{
this->Close() ;
return;
}
Receive(buff, sizeof(buff),2);
Msg =CString(buff).Mid(1);
}
Receive(buff, sizeof(buff),0);
receivecheck=Msg;
isreceivecheck=true;
CSocket::OnReceive(nErrorCode);
}
图片1
图片2
图片3
图1图2出错相关代码:
5
6
7
8
9
10
BOOL CAsyncSocket::AsyncSelect(long lEvent)
{
ASSERT(m_hSocket != INVALID_SOCKET);//第386行
_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;
ASSERT(pState->m_hSocketWindow != NULL);//第389行
return WSAAsyncSelect(m_hSocket, pState->m_hSocketWindow,
WM_SOCKET_NOTIFY, lEvent) != SOCKET_ERROR;
}
图3出错相关代码:
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
{ ASSERT(afxCurrentInstanceHandle != NULL);//第21行
return afxCurrentInstanceHandle; }
相关解决方案