ORM Designer Blog

18Jun/100

Problem with execution application – side-by-side configuration problem

Were you having troubles finding the solution when you received this message? "The application has failed to start because its side-by-side configuration is incorect. Please see the application event log for more detail." This error message may look different depending on the MS Windows version:


These error messages don't tell you much and you have to dig deeper to get the information you need. Open event viewer:

  1. Manage computer
  2. Computer Management ->System Tools ->Event viewer->Windows Logs->System
  3. Click on the error log row

You should see something similar to this:

Activation context generation failed for "\\192.168.0.10\e$\Microsoft Visual Studio\prog.all\OrmDesignerCore\Release\OrmDesignerCore.exe". Dependent Assembly Microsoft.VC80.MFC,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053" could not be found. Please use sxstrace.exe for detailed diagnosis.

Solution:

First of all, you need to download right version of Microsoft redist pack. Latest version (currently 8.0) can be found at:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=766a6af7-ec73-40ff-b072-9112bab119c2

You will recognize correct version by the "Version" item on the page. In our case we need version 8.0.xxxx. Unfortunately you can't see full version number on the page, you need to open "Knowledge Base (KB) Articles:" to see full version name. This version name must match the version needed by your application. Once the redist pack is installed the problem should be solved. In some cases you need to restart the computer for the changes to take effect.

Tagged as: No Comments
3Jun/100

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 == '\0')
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;
    break;

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 == '\0' )
      goto Error;
    sz = CharTraits::Next(szCurrInput);
    szCurrInput = sz;
    if ( sz == NULL || *sz == '\0')
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;
    break;

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.

Note

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.

Tagged as: No Comments