Visual Studio 2015 Oracle exception debug assertion

I'm using Visual Studio 2015 Enterprise with Oracle 12.1.0. Here's the code causing assertion:
1
2
3
4
5
6
7
8
try
{
    // ..
}catch(oracle::occi::SQLException &e)
{
    std::cout << "Error code: " << e.getErrorCode() << std::endl;
    std::cout << "Error message: " << e.getMessage() << std::endl;   // Most likely here 
}


Debug assertion: __acrt_first_block == header
I'm assuming it has something to do with std::string being allocated by dll and deallocated by application but I'm not sure. Also I got no idea on how to fix it.
It has probable to do with the reference

catch(oracle::occi::SQLException &e)


I rarly use exception, but I would guess that the exception is no longer valid at that point. Try changing it to

catch(const oracle::occi::SQLException &e)
Thanks for the reply. That didn't work sadly. ::getMessage returns the error string as expected but crashes at deallocator.
You could try
1
2
3
4
5
catch(oracle::occi::SQLException &e)
{
    std::cout << "Error code: " << e.getErrorCode() << std::endl;
    std::cout << "Error message: " << e.what() << std::endl;   // Most likely here 
}
@Thomas1965 Wow thank you very much that did the trick.

Although there're still some issues. For example if I want to use ResultSet::getString(..) I'll probably still get the error. How would I go about fixing that?
Last edited on
Glad that it worked.

What did the error actually say?

I guess you need to fix the error first.
It says "Debug assertion failed" with __acrt_first_block == header. Breakpoint is at the end of void _Deallocate(void * _Ptr, size_t _Count, size_t _Sz); function in xmemory0 where it calls ::operator delete(_Ptr);
It says "Debug assertion failed" with __acrt_first_block == header. Breakpoint is at the end of void _Deallocate(void * _Ptr, size_t _Count, size_t _Sz); function in xmemory0 where it calls ::operator delete(_Ptr);


Sorry I was not clear enough. I ment the msg in e.what(). Could you maybe post some code between the try and catch block? My guess is that there is some error before which actually leads to the exception thrown.
Oh database connection was failing so that was the reason of exception. Overall library works as expected it's just std::string related functions. They work but crash at deallocation.
I agree with PaulMcKenzie in your SO post http://stackoverflow.com/questions/34662466/oracle-exception-getmessage-causing-debug-assertion

It doesn't look like occi supports VS 2015 yet.

I guess I'll have to keep using vc12 until they release vc14 version then..
Maybe give this a try http://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index-097110.html
it says it supports 2015.

EDIT: Actually after a closer look, it seems it's .Net only.
Last edited on
OCCI 12cR1 is supported with VS2010, VS2012 and VS2013. Not with VS2015. Please see https://docs.oracle.com/database/121/NTCLI/pre_install.htm#NTCLI1252
Topic archived. No new replies allowed.