When building Release|Win32 configuration with cross dll boundary exceptions, causes the throw exception not to be caught by the provided catch block.
I have a attached a small VS2012 solution to reproduce the problem. It contains 2 vcxproj files:
ClassLibrary1: contains 2 classes. The first is a custom exception MyException, that inherits from std::exception, and just stores a given bool. The second class is a worker class which has 1 public inlined work method and 1 private work method. The public method forwards the call to the private method. The private method will always throw MyException.
TestConsole: contains a simple c++ console application that creates a worker object from the second project and let is do some work in a try-catch statement. The catch statement catches the exception of type MyException.
When building in Debug|Win32 this works correctly. When building Release|Win32, the catch block is never executed and results in a uncaught exception. It seems to be related to the inline statements for public method of the Worker class. If it's implemented as non-inline, it works correctly for release as well.
This example is just a simplified reproduction of real production code in our c++ back-end, so the problem is not pure academic.
This should not be this way. Release and Debug should both catch the thrown exception.
*My apologies for the confusing file attachments. For the solution to reproduce, use the most recent ConsoleApplication.zip. The other one may not open correctly.