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. Switch off Debug Assertions

Switch off Debug Assertions

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncementdebugginghelp
13 Posts 9 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.
  • M Offline
    M Offline
    mackel90
    wrote on last edited by
    #1

    Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

    _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
    { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

    With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

    Richard Andrew x64R J C P L 8 Replies Last reply
    0
    • M mackel90

      Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

      _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
      { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

      With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      You could try redefining the ASSERT macro into something that doesn't do anything.

      The difficult we do right away... ...the impossible takes slightly longer.

      L 2 Replies Last reply
      0
      • M mackel90

        Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

        _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
        { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

        With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        mackel90 wrote:

        but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application.

        http://www.guynirpaz.com/2012/06/11/good-developer-bad-developer/[^]

        1 Reply Last reply
        0
        • M mackel90

          Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

          _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
          { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

          With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

          C Offline
          C Offline
          Chuck OToole
          wrote on last edited by
          #4

          mackel90 wrote:

          i got a huge project which works nice in release build

          You realize that the assertion is telling you that you are issuing Scroll Bar Functions to an object that is not realized as a window. That is, the fact that m_HWND is NULL means that you are trying to scroll a window that doesn't exist. I'm not sure of your definition of "working fine" but this ain't my definiton. You should fix these.

          1 Reply Last reply
          0
          • M mackel90

            Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

            _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
            { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

            With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

            P Offline
            P Offline
            Philippe Mori
            wrote on last edited by
            #5

            You should never, never ignore such assertions. If such assertions fail, it mean that your code is wrong and shouild be fixed. By the way, if you somehow disable assertion there, then what would happen with assertion in your own code. Assertion is a tool to help make good and correct code. Learn to use them correctly.

            Philippe Mori

            1 Reply Last reply
            0
            • M mackel90

              Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

              _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
              { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

              With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

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

              This post shouldnt be voted down because it is important that beginner programmers understand why DEBUG ASSERTS must be resolved. mackel90, you really need to learn to program properly. And so do your colleagues who put this project together. Read the other good comments here, and think very very carefully about what is being said. YOU MUST RESOLVE THESES DEBUG ASSERTS BEFORE YOU BUILD A RELEASE VERSION. It is also good practice to back up a DEBUG ASSERT with a line of code that checks the same thing and exits the func so in release mode you have the same level of protection.

              ============================== Nothing to say.

              1 Reply Last reply
              0
              • Richard Andrew x64R Richard Andrew x64

                You could try redefining the ASSERT macro into something that doesn't do anything.

                The difficult we do right away... ...the impossible takes slightly longer.

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

                You sir, are a dangerous idiot. Seriously, no one listen to this, it is dangerous stupid advise.

                ============================== Nothing to say.

                Richard Andrew x64R 1 Reply Last reply
                0
                • Richard Andrew x64R Richard Andrew x64

                  You could try redefining the ASSERT macro into something that doesn't do anything.

                  The difficult we do right away... ...the impossible takes slightly longer.

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

                  That would only work if you rebuilt the entire Windows debug library.

                  speaking as ...

                  1 Reply Last reply
                  0
                  • M mackel90

                    Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

                    _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
                    { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

                    With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

                    A Offline
                    A Offline
                    AmbiguousName
                    wrote on last edited by
                    #9

                    Take my opinion as a pointer, not a definite answer. Most likely you are doing something with one of your controls when it is not loaded/initialized yet. For example, say you have a dialogbox named CMainDlg. Now If you try to set text of an editbox in CMainDlg's constructor like this

                    CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/): CDialogEx(CAccountDlg::IDD, pParent)
                    {
                    GetDlgItem(IDC_TEXT1)->SetWindowText("Debug Assertion");
                    }

                    then a debug assertion will be shown. A better way will be do this in OnInitDialog like this (or in an event handler, bound with a button)

                    BOOL CMainDlg::OnInitDialog()
                    {
                    GetDlgItem(IDC_TEXT1)->SetWindowText(" No Debug Assertion");

                    // some other stuff
                    }

                    So out and out, you are doing a right thing in a wrong way. Hope you understand what I mean :)

                    This world is going to explode due to international politics, SOON.

                    1 Reply Last reply
                    0
                    • L Lost User

                      You sir, are a dangerous idiot. Seriously, no one listen to this, it is dangerous stupid advise.

                      ============================== Nothing to say.

                      Richard Andrew x64R Offline
                      Richard Andrew x64R Offline
                      Richard Andrew x64
                      wrote on last edited by
                      #10

                      Erudite_Eric wrote:

                      it is dangerous stupid advise.

                      You sir, are an illiterate idiot.

                      The difficult we do right away... ...the impossible takes slightly longer.

                      L 1 Reply Last reply
                      0
                      • M mackel90

                        Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

                        _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
                        { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

                        With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

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

                        mackel90 wrote:

                        ...i got a huge project which works nice in release build...

                        No, you just think it is working nicely. The problems just haven't shown themselves visibly yet.

                        mackel90 wrote:

                        ...I do not want to care about what is wrong, I only want to get my work done quickly...

                        Please do not work on any projects used by folks other than yourself.

                        "One man's wage rise is another man's price increase." - Harold Wilson

                        "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

                        "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

                        1 Reply Last reply
                        0
                        • M mackel90

                          Hi, I have a problem, i got a huge project which works nice in release build, but in debug version I get thousands of debug assertion failures, which i realy dont want to care about. It is this kind of thing what is failing (in afxwin2.inl): (m_hWnd is NULL)

                          _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow)
                          { ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, nBar, bShow); }

                          With these debug assertions it is not possible for me to Debug the project. I just want to change a little part of the project, but without debugmode (i need traces and so on) this will become very hard, so it is in any way possible to switch them off ? And yes, i know assertions are my best friend, because they tell me something is wrong, but in this case I do not want to care about what is wrong, I only want to get my work done quickly without reprogramming the application. Thank you ;)

                          J Offline
                          J Offline
                          jkirkerx
                          wrote on last edited by
                          #12

                          mackel90 wrote:

                          I only want to get my work done quickly

                          The foresight of that thought sure seems to be an oxy-moron in hindsight I want to get my work done quickly today, so I can triple my work tomorrow. I still don't understand how the current release version can work perfectly, unless he broke the project and can't fix it, or the current release version was never fully tested, and it really doesn't work perfectly. Perhaps the OP is having a really bad day, and is ready to go postal.

                          1 Reply Last reply
                          0
                          • Richard Andrew x64R Richard Andrew x64

                            Erudite_Eric wrote:

                            it is dangerous stupid advise.

                            You sir, are an illiterate idiot.

                            The difficult we do right away... ...the impossible takes slightly longer.

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

                            Well, its a nod to the colonials! :)

                            ============================== Nothing to say.

                            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