Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Debug Assertion Failed

Debug Assertion Failed

Scheduled Pinned Locked Moved C / C++ / MFC
debugginghelptutorial
21 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Cedric Moonen

    Davitor wrote:

    how to solve this Debug

    One day you'll have to learn how to use your debugger instead of posting a question each time you have an assert failure. Furthermore, we can't help at all because you didn't provide any usefull information (no code, no crash location, ...).

    Cédric Moonen Software developer
    Charting control [v2.0] OpenGL game tutorial in C++

    D Offline
    D Offline
    Davitor
    wrote on last edited by
    #4

    Thanks for reply. i use debugger but i havn't found that time exception.

    void CDelayedDirectoryChangeHandler::On_FileAdded(const CString & strFileName)
    {
    CStringArray szaddcopyFiles;
    CString strFileName;
    CString path="D:\\DVD";
    szaddcopyFiles.Add(strFileName);

    int numofcopyitems = szaddcopyFiles.GetSize();
    if (numofcopyitems > 0)
    {
    tr=1;
    for(;aq<numofcopyitems;)
    {
    finalString=szaddcopyFiles.GetAt(i);

     strFileName1=finalString;
     for(int idc=0;idc<5;idc++)
     {
    	AfxBeginThread(WorkerThreadProc1,NULL,THREAD\_PRIORITY\_NORMAL,0,0,NULL);
    	WaitForSingleObject(WorkerThreadProc1, INFINITE);
     }
    

    }
    }

    	if(tr==1)
    	{
    		
    		szaddcopyFiles.RemoveAll();
    		tr=0;
    	}
    

    }

    UINT WorkerThreadProc(LPVOID Param)
    {
    CFileOperation fo;
    CString tr=finalString;

    	int nLen = tr.GetLength();
    	
    	LPCSTR lpszBuf = tr.GetBufferSetLength(nLen);
    	tr.ReleaseBuffer(nLen);
    	LPCSTR pF=lpszBuf;
    	
    	
    		CStdioFile file;
    		fo.SetOverwriteMode(TRUE);
    		if(fo.Copy(pF,pT));
    		
    
    		//int nPos1121 = finalString.ReverseFind('\\\\');
    		int nPos2121 = finalString.ReverseFind('.');
    

    if( nPos2121 > -1)
    {
    if (file.Open(_T(finalString), CFile::modeRead | CFile::modeNoTruncate))
    {

    				ULONGLONG dwFileSize;
    				dwFileSize = GetFileSize(file,  NULL);
    				float fVar;
    				str1.Format(\_T("%I64u"), dwFileSize);
    				file.Close();
    			}
    		
    
    
    	AfxBeginThread(WorkerThreadProccd,NULL,THREAD\_PRIORITY\_NORMAL,0,0,NULL);
    	WaitForSingleObject(WorkerThreadProccd, INFINITE);
    

    }
    return TRUE;
    }
    UINT WorkerThreadProccd(LPVOID Param)
    {
    CFileOperation fo;
    CString tr1=finalString;
    int nLen1 = tr1.GetLength();
    //LPCSTR lpszBuf1 = tr1.GetBuffer(nLen1);
    LPCSTR lpszBuf1 = tr1.GetBufferSetLength(nLen1);
    tr1.ReleaseBuffer(nLen1);
    LPCSTR pF1=lpszBuf1;

    	if(fo.Copy(pF1,pT));
    return TRUE;
    

    }

    Now i hope you will help me..

    C R 2 Replies Last reply
    0
    • D Davitor

      Thanks for reply. i use debugger but i havn't found that time exception.

      void CDelayedDirectoryChangeHandler::On_FileAdded(const CString & strFileName)
      {
      CStringArray szaddcopyFiles;
      CString strFileName;
      CString path="D:\\DVD";
      szaddcopyFiles.Add(strFileName);

      int numofcopyitems = szaddcopyFiles.GetSize();
      if (numofcopyitems > 0)
      {
      tr=1;
      for(;aq<numofcopyitems;)
      {
      finalString=szaddcopyFiles.GetAt(i);

       strFileName1=finalString;
       for(int idc=0;idc<5;idc++)
       {
      	AfxBeginThread(WorkerThreadProc1,NULL,THREAD\_PRIORITY\_NORMAL,0,0,NULL);
      	WaitForSingleObject(WorkerThreadProc1, INFINITE);
       }
      

      }
      }

      	if(tr==1)
      	{
      		
      		szaddcopyFiles.RemoveAll();
      		tr=0;
      	}
      

      }

      UINT WorkerThreadProc(LPVOID Param)
      {
      CFileOperation fo;
      CString tr=finalString;

      	int nLen = tr.GetLength();
      	
      	LPCSTR lpszBuf = tr.GetBufferSetLength(nLen);
      	tr.ReleaseBuffer(nLen);
      	LPCSTR pF=lpszBuf;
      	
      	
      		CStdioFile file;
      		fo.SetOverwriteMode(TRUE);
      		if(fo.Copy(pF,pT));
      		
      
      		//int nPos1121 = finalString.ReverseFind('\\\\');
      		int nPos2121 = finalString.ReverseFind('.');
      

      if( nPos2121 > -1)
      {
      if (file.Open(_T(finalString), CFile::modeRead | CFile::modeNoTruncate))
      {

      				ULONGLONG dwFileSize;
      				dwFileSize = GetFileSize(file,  NULL);
      				float fVar;
      				str1.Format(\_T("%I64u"), dwFileSize);
      				file.Close();
      			}
      		
      
      
      	AfxBeginThread(WorkerThreadProccd,NULL,THREAD\_PRIORITY\_NORMAL,0,0,NULL);
      	WaitForSingleObject(WorkerThreadProccd, INFINITE);
      

      }
      return TRUE;
      }
      UINT WorkerThreadProccd(LPVOID Param)
      {
      CFileOperation fo;
      CString tr1=finalString;
      int nLen1 = tr1.GetLength();
      //LPCSTR lpszBuf1 = tr1.GetBuffer(nLen1);
      LPCSTR lpszBuf1 = tr1.GetBufferSetLength(nLen1);
      tr1.ReleaseBuffer(nLen1);
      LPCSTR pF1=lpszBuf1;

      	if(fo.Copy(pF1,pT));
      return TRUE;
      

      }

      Now i hope you will help me..

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #5

      Davitor wrote:

      Now i hope you will help me..

      It would much easier if you provide the exact crash location, and eventually copy the call stack.

      Cédric Moonen Software developer
      Charting control [v2.0] OpenGL game tutorial in C++

      D 1 Reply Last reply
      0
      • C Cedric Moonen

        Davitor wrote:

        Now i hope you will help me..

        It would much easier if you provide the exact crash location, and eventually copy the call stack.

        Cédric Moonen Software developer
        Charting control [v2.0] OpenGL game tutorial in C++

        D Offline
        D Offline
        Davitor
        wrote on last edited by
        #6

        crash location showing here.

        ATLASSERT( nLength <= GetData()->nAllocLength );

        in file atlsimpstr.h. Plz help me..

        R 1 Reply Last reply
        0
        • D Davitor

          Thanks for reply. i use debugger but i havn't found that time exception.

          void CDelayedDirectoryChangeHandler::On_FileAdded(const CString & strFileName)
          {
          CStringArray szaddcopyFiles;
          CString strFileName;
          CString path="D:\\DVD";
          szaddcopyFiles.Add(strFileName);

          int numofcopyitems = szaddcopyFiles.GetSize();
          if (numofcopyitems > 0)
          {
          tr=1;
          for(;aq<numofcopyitems;)
          {
          finalString=szaddcopyFiles.GetAt(i);

           strFileName1=finalString;
           for(int idc=0;idc<5;idc++)
           {
          	AfxBeginThread(WorkerThreadProc1,NULL,THREAD\_PRIORITY\_NORMAL,0,0,NULL);
          	WaitForSingleObject(WorkerThreadProc1, INFINITE);
           }
          

          }
          }

          	if(tr==1)
          	{
          		
          		szaddcopyFiles.RemoveAll();
          		tr=0;
          	}
          

          }

          UINT WorkerThreadProc(LPVOID Param)
          {
          CFileOperation fo;
          CString tr=finalString;

          	int nLen = tr.GetLength();
          	
          	LPCSTR lpszBuf = tr.GetBufferSetLength(nLen);
          	tr.ReleaseBuffer(nLen);
          	LPCSTR pF=lpszBuf;
          	
          	
          		CStdioFile file;
          		fo.SetOverwriteMode(TRUE);
          		if(fo.Copy(pF,pT));
          		
          
          		//int nPos1121 = finalString.ReverseFind('\\\\');
          		int nPos2121 = finalString.ReverseFind('.');
          

          if( nPos2121 > -1)
          {
          if (file.Open(_T(finalString), CFile::modeRead | CFile::modeNoTruncate))
          {

          				ULONGLONG dwFileSize;
          				dwFileSize = GetFileSize(file,  NULL);
          				float fVar;
          				str1.Format(\_T("%I64u"), dwFileSize);
          				file.Close();
          			}
          		
          
          
          	AfxBeginThread(WorkerThreadProccd,NULL,THREAD\_PRIORITY\_NORMAL,0,0,NULL);
          	WaitForSingleObject(WorkerThreadProccd, INFINITE);
          

          }
          return TRUE;
          }
          UINT WorkerThreadProccd(LPVOID Param)
          {
          CFileOperation fo;
          CString tr1=finalString;
          int nLen1 = tr1.GetLength();
          //LPCSTR lpszBuf1 = tr1.GetBuffer(nLen1);
          LPCSTR lpszBuf1 = tr1.GetBufferSetLength(nLen1);
          tr1.ReleaseBuffer(nLen1);
          LPCSTR pF1=lpszBuf1;

          	if(fo.Copy(pF1,pT));
          return TRUE;
          

          }

          Now i hope you will help me..

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #7

          Provide only the code that has relevance with this issue and take your time to align the code properly. Also, what is tr, finalstring, etc.,? There's a global tr (I don't see it declared anywhere) and another tr inside your worker thread function code with local scope. A perfect recipe for disaster. This is one rare case where I'm going to encourage cross-posting. You may kindly cross-post your code at the coding horror forum too.

          It is a crappy thing, but it's life -^ Carlo Pallini

          D C C 4 Replies Last reply
          0
          • R Rajesh R Subramanian

            Provide only the code that has relevance with this issue and take your time to align the code properly. Also, what is tr, finalstring, etc.,? There's a global tr (I don't see it declared anywhere) and another tr inside your worker thread function code with local scope. A perfect recipe for disaster. This is one rare case where I'm going to encourage cross-posting. You may kindly cross-post your code at the coding horror forum too.

            It is a crappy thing, but it's life -^ Carlo Pallini

            D Offline
            D Offline
            Davitor
            wrote on last edited by
            #8

            Thanks Subramanian ji i had send code where issue will be generated.And next time i align code proper.

            1 Reply Last reply
            0
            • D Davitor

              crash location showing here.

              ATLASSERT( nLength <= GetData()->nAllocLength );

              in file atlsimpstr.h. Plz help me..

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #9

              Hello! Which line of "your" code is triggering this assertion?

              It is a crappy thing, but it's life -^ Carlo Pallini

              D 1 Reply Last reply
              0
              • R Rajesh R Subramanian

                Provide only the code that has relevance with this issue and take your time to align the code properly. Also, what is tr, finalstring, etc.,? There's a global tr (I don't see it declared anywhere) and another tr inside your worker thread function code with local scope. A perfect recipe for disaster. This is one rare case where I'm going to encourage cross-posting. You may kindly cross-post your code at the coding horror forum too.

                It is a crappy thing, but it's life -^ Carlo Pallini

                D Offline
                D Offline
                Davitor
                wrote on last edited by
                #10

                Yes tr, finalstring both are globle. Worker thread it's not tr it is tt.So sorry for that.

                C 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  Hello! Which line of "your" code is triggering this assertion?

                  It is a crappy thing, but it's life -^ Carlo Pallini

                  D Offline
                  D Offline
                  Davitor
                  wrote on last edited by
                  #11

                  That's a problem Subramanian ji. When i go through Debug then i han't got assertion and when i go through normal mode then i got some time this assertion.This assertion not come regullar.So i han't got exact line of code.If it is possible then help me

                  R 1 Reply Last reply
                  0
                  • R Rajesh R Subramanian

                    Provide only the code that has relevance with this issue and take your time to align the code properly. Also, what is tr, finalstring, etc.,? There's a global tr (I don't see it declared anywhere) and another tr inside your worker thread function code with local scope. A perfect recipe for disaster. This is one rare case where I'm going to encourage cross-posting. You may kindly cross-post your code at the coding horror forum too.

                    It is a crappy thing, but it's life -^ Carlo Pallini

                    C Offline
                    C Offline
                    Cedric Moonen
                    wrote on last edited by
                    #12

                    Rajesh R Subramanian wrote:

                    This is one rare case where I'm going to encourage cross-posting. You may kindly cross-post your code at the coding horror forum too.

                    :laugh:

                    Cédric Moonen Software developer
                    Charting control [v2.0] OpenGL game tutorial in C++

                    1 Reply Last reply
                    0
                    • D Davitor

                      Yes tr, finalstring both are globle. Worker thread it's not tr it is tt.So sorry for that.

                      C Offline
                      C Offline
                      chirag_chauhan
                      wrote on last edited by
                      #13

                      It's better if you can try out sample application with minimum code including function that cause the error that will help you to get into exact problem. And it will also helps others to find out exact cause of problem and to give appropriate solution.

                      1 Reply Last reply
                      0
                      • D Davitor

                        That's a problem Subramanian ji. When i go through Debug then i han't got assertion and when i go through normal mode then i got some time this assertion.This assertion not come regullar.So i han't got exact line of code.If it is possible then help me

                        R Offline
                        R Offline
                        Rajesh R Subramanian
                        wrote on last edited by
                        #14

                        Try different test cases and narrow down the number of cases for which the crash is occurring. You might as well output text to the debugger window from within your code (if you are not running under the VS debugger, you can still use an external debugger[^] (just connect it to the local machine) and use something like OutputDebugString[^] to print to the debugger). The actual problem might be something as trivial as writing to a pointer that has been released, accessing memory that you don't own, etc., But you need to locate it first.

                        It is a crappy thing, but it's life -^ Carlo Pallini

                        D 2 Replies Last reply
                        0
                        • R Rajesh R Subramanian

                          Try different test cases and narrow down the number of cases for which the crash is occurring. You might as well output text to the debugger window from within your code (if you are not running under the VS debugger, you can still use an external debugger[^] (just connect it to the local machine) and use something like OutputDebugString[^] to print to the debugger). The actual problem might be something as trivial as writing to a pointer that has been released, accessing memory that you don't own, etc., But you need to locate it first.

                          It is a crappy thing, but it's life -^ Carlo Pallini

                          D Offline
                          D Offline
                          Davitor
                          wrote on last edited by
                          #15

                          Thanks for debugger information.How can i use it?

                          1 Reply Last reply
                          0
                          • R Rajesh R Subramanian

                            Try different test cases and narrow down the number of cases for which the crash is occurring. You might as well output text to the debugger window from within your code (if you are not running under the VS debugger, you can still use an external debugger[^] (just connect it to the local machine) and use something like OutputDebugString[^] to print to the debugger). The actual problem might be something as trivial as writing to a pointer that has been released, accessing memory that you don't own, etc., But you need to locate it first.

                            It is a crappy thing, but it's life -^ Carlo Pallini

                            D Offline
                            D Offline
                            Davitor
                            wrote on last edited by
                            #16

                            external debugger

                            is not working.And i have no idia how to find assertion line plz help me

                            1 Reply Last reply
                            0
                            • D Davitor

                              Hi All how to solve this Debug.

                              unhandled exception at 0x00541ccf in Test.exe:0xC0000005;Access vilolation reading location 0xfeeefeee

                              Plz help me

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #17

                              An assertion is completely different than an exception. So which is it?

                              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                              1 Reply Last reply
                              0
                              • D Davitor

                                Hi All how to solve this Debug.

                                unhandled exception at 0x00541ccf in Test.exe:0xC0000005;Access vilolation reading location 0xfeeefeee

                                Plz help me

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #18

                                Davitor wrote:

                                Access vilolation reading location 0xfeeefeee

                                0xfeeefeee is a Magic Number[^] which has a meaning. This essentially means that you are trying to access memory AFTER it has been freed. You should begin debugging by checking the variables that you are accessing in your worker thread. Best Wishes, -David Delaune

                                1 Reply Last reply
                                0
                                • D Davitor

                                  Hi All how to solve this Debug.

                                  unhandled exception at 0x00541ccf in Test.exe:0xC0000005;Access vilolation reading location 0xfeeefeee

                                  Plz help me

                                  S Offline
                                  S Offline
                                  Stephen Hewitt
                                  wrote on last edited by
                                  #19

                                  Google is your friend: try this[^].

                                  Steve

                                  1 Reply Last reply
                                  0
                                  • R Rajesh R Subramanian

                                    Provide only the code that has relevance with this issue and take your time to align the code properly. Also, what is tr, finalstring, etc.,? There's a global tr (I don't see it declared anywhere) and another tr inside your worker thread function code with local scope. A perfect recipe for disaster. This is one rare case where I'm going to encourage cross-posting. You may kindly cross-post your code at the coding horror forum too.

                                    It is a crappy thing, but it's life -^ Carlo Pallini

                                    C Offline
                                    C Offline
                                    CPallini
                                    wrote on last edited by
                                    #20

                                    Welcome pal. BTW That's wonderful. :-D

                                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                    [My articles]

                                    R 1 Reply Last reply
                                    0
                                    • C CPallini

                                      Welcome pal. BTW That's wonderful. :-D

                                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                      [My articles]

                                      R Offline
                                      R Offline
                                      Rajesh R Subramanian
                                      wrote on last edited by
                                      #21

                                      Ah, thanks. :-O

                                      It is a crappy thing, but it's life -^ Carlo Pallini

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • World
                                      • Users
                                      • Groups