Developer Blog -
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Tag: #visual studio

Slow execution of application from Visual studio

Today my Visual Studio 2010 started to execute my application super slowly. When I tried to execute my application (without any changes in source-code) the delay between "Start Debugging" and application start was about one minute.

I know that too many breakpoints or breakpoints in templates could caused this, but I don't see any breakpoint in my Breakpoints window.

Breakpoint window

But as I have found that the problem was really caused by breakpoints. In some special cases - when you're using some external tools to modified your project file (.sln/.vcxproj) - breakpoints can disappear and begin to make a trouble (I'm using Qt qmake to update my project based on .pro files.)

The solution is pretty easy. Use **Delete All Breakpoins** from Debug menu:

Delete all breakpoints

And your problem will be solved ;-).

21 Sep 2013

Error in RegEx (atlrx.h) in Visual Studio C++ 2003 and 2005

During our development we found that Microsoft RegEx (Regular expression) implementation contains a bug which caused crashes of our applications. The application module using RegEx passed all unit test, but sometimes under heavy usage the application crashed at our customer. Because we use **BugTrap **for error and crash notifications, we knew the error was in atlrx.h file.

After several hours of testing and searching we found the bug. The crash didn't occur after first code execution, but we had to run thousand iterations of the same code over and over. The bug is located in file atlrx.h at line 708.

Original file looks like this:

  case RE_ADVANCE:
    sz = CharTraits::Next(szCurrInput);
    szCurrInput = sz;
    if ( sz == NULL || *sz == '
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;

Problem is, that variable szCurrInput have in some circumstances NULL value and this causes the crashes.

**Updated file with bug fix:**

  case RE_ADVANCE:
    if( szCurrInput == NULL || *szCurrInput == '
' )
      goto Error;
    sz = CharTraits::Next(szCurrInput);
    szCurrInput = sz;
    if ( sz == NULL || *sz == '
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;

We change the first two lines. It is necessary to test szCurrInput variable for NULL and empty string value. If szCurrInput is NULL or empty string, it's necessary to stop processing RegEx. Otherwise stack overflow during processing string occurs.


Some time later we had other problems with Microsoft RegEx implementation and non-standard RegEx syntax. So we left MS RegEx parser and moved to Boost.Regex which is really nice piece of code (as well as other libraries of the Boost pack) and supports Perl and POSIX regular expressions. Whole Boost library is carefully unit test and can be relied on.

28 Aug 2013

Posted by: ludek.vodicka

Programming #C++ #visual studio #regex #bug #atl

Qt application crash when compiled for 64-bit VS2010


&gt;	QtGui4.dll!00000000652f071f()<br />
 	[Frames below may be incorrect and/or missing, no symbols loaded for QtGui4.dll]<br />
 	QtGui4.dll!00000000652f07ae()<br />
 	QtGui4.dll!0000000065326821()<br />
 	QtGui4.dll!0000000065327f30()<br />
 	QtGui4.dll!00000000653284ba()<br />
 	QtGui4.dll!000000006532a5f5()<br />
 	QtGui4.dll!00000000652f4792()<br />
 	QtGui4.dll!000000006532f701()<br />
 	QtGui4.dll!000000006535be71()<br />
 	QtCore4.dll!0000000059a0ab9f()<br />
 	QtGui4.dll!0000000065306eb9()<br />
 	QtCore4.dll!00000000599f7903()<br />
 	QtGui4.dll!0000000064eaffa2()<br />
 	QtGui4.dll!0000000064eb2e56()<br />
 	QtCore4.dll!00000000599f7792()<br />
 	QtGui4.dll!0000000064eec2a3()<br />
 	QtGui4.dll!0000000064eee85e()<br />
 	QtGui4.dll!0000000064eec265()<br />
 	QtGui4.dll!0000000064eee85e()<br />
 	QtGui4.dll!0000000064eec265()<br />
 	QtGui4.dll!0000000064eee85e()<br />
 	QtGui4.dll!0000000064efa870()<br />
 	QtGui4.dll!0000000065208727()<br />
 	QtGui4.dll!000000006527a082()<br />
 	QtGui4.dll!0000000064eaffb6()<br />
 	QtGui4.dll!0000000064eb2e56()<br />
 	QtCore4.dll!00000000599f7792()<br />
 	QtGui4.dll!0000000064ef264c()<br />
 	QtGui4.dll!0000000064ef26c7()<br />
 	QtGui4.dll!0000000064ef26c7()<br />
 	QtGui4.dll!0000000064ef26c7()<br />
 	QtGui4.dll!0000000064efe30c()<br />
 	OrmDesigner2.exe!000000013f95a2cf()<br />
 	OrmDesigner2.exe!000000013f95dce2()<br />
 	kernel32.dll!000000007794652d()<br />
 	ntdll.dll!0000000077c8c521()<br />

The bug is probably caused by wrong alignment or incorrect VS2010 compiler optimalization.

Found resources:


First way - Update VS2010 mkspec for Qt

go to $QTDIR/mkspecs/win32-msvc2010/qmake.conf and replace -02 with -01 (ie. reducing the optimzation level).Also /Ob0 could be used.

Microsoft hotfix for VS
File patch name VS10-KB2268081-x86.exe

Install Visual Studio 2010 SP1

Service pack could also contains required fix.

22 Nov 2011

List of usefull links for Visual Studio

How to customize autoexp.dat in Visual Studio 2005

Example visualizator for XString

String::CStringSmart&lt;String::malloc_string_trait&lt;String::string_trait&lt;char&gt; &gt; &gt;{<br />
  preview([$c.m_pszData,s])<br />
  stringview([$c.m_pszData,sb])<br />
<p>String::CStringSmart&lt;String::malloc_string_trait&lt;String::string_trait&lt;wchar_t&gt; &gt; &gt;{<br />
  preview([$c.m_pszData,su])<br />
  stringview([$c.m_pszData,sub])<br />
}<br />

How to configure STEP-INTO for Visual Studio 2005

External links:
Google group

Example how to setup ingoring step-into for MFC CString for VS2005

Windows Registry Editor Version 5.00<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NativeDE\StepOver]<br />
&quot;\&quot;20\&quot;&quot;=&quot;\\scope:CString.*\\:\\:.*=NoStepInto&quot;<br />
&quot;\&quot;21\&quot;&quot;=&quot;\\scope:CSmartObjPtr.*\\:\\:.*=NoStepInto&quot;<br />

Example how to setup ingoring step-into for MFC CString for VS2010 on 64bit system

Windows Registry Editor Version 5.00</p>
<p>[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\NativeDE\StepOver]<br />
&quot;22&quot;=&quot;.*CStringSmart.*=NoStepInto&quot;<br />

10 Nov 2010

Posted by: ludek.vodicka

Programming #C++ #visual studio