Use VSASSERT to help debug

Here is a second tip for debugging that requires a slight .h file change. If you have the VSIP SDK installed  and you need advanced assert help, use VSASSERT. VSASSERT is a nifty utility that is installed with the VSIP SDK that will put up an assert message. The advantage of this assert technology over the CRT or ATL’s assert is that you can hide all the VS asserts for that instance of VS, selectively choose to hide a particular assert, copy the assert text to the clipboard, break into the debugger at the line of the offending assert, etc. To use this assert, you need to #include the file vsassert.h into your code, and then for the debug build of your code link to vsassert.lib. Then, rather than using VC’s assert mechanism, you use VS’s like so:


VSASSERT(false, “This is a failed assert.”);


Even though the assert ships with the VSIP SDK, your code does not need to be VSIP related to use VSASSERT, the code can be a VSIP package, an Add-in, or even code that is not related to VS, you just need to be using C++.


Now to the problem: To use VSASSERT, you will need to change a header file to get everything to work. If you were to compile anything that #includes vsassert.h, you will get the following error message:


c:\Program Files\VSIP 7.1\EnvSDK\common\inc\vsassert.h(249): fatal error C1017: invalid integer constant expression


You can fix this by opening vsassert.h, and on line 249 change the text from:

            #if DEBUG


            #ifdef _DEBUG

This simple change will fix up the problem, and you can start using a much better assert tool. (And yes, there is a bug tracking this to have somebody fix it)

Comments (1)

  1. jyner_lz says:

    <a href= >rsc cares</a> <a href= >hud inspectors</a> <a href= >dft</a> <a href= >fas fixed assets</a> <a href= >lake oswego football</a>