web::uri

Sep 23, 2015 at 5:56 PM
Hi!

I'm using the http client on a large project. When I create a uri and instantiate my client everything goes well, but when through the debugger I leave the method in which I create the web::uri, my program crashes (Even if the only thing I do is to create the uri). If I don't create the uri, the method exits successfully.

I have several preprocessor directives in my project, so I wonder if any of those might be interfering with the string types the library uses maybe?

If I use the code below, I get an access violation
web::uri uri(U("https://myserver.net"));
If instead of a hardcoded path I pass a wchar_t*, I get an error like the following:
Debug Assertion Failed!
Expression" _BLOCK_TYPE_IS_VALID(pHead-> nBlockUse)
And these are the preprocessor directives in my project
NDEBUG;_WIN64;_AMD64_;AMD64;CONDITION_HANDLING=1;NT_UP=1;NT_INST=0;WIN32=100;_NT1X_=100;WINNT=1;_WIN32_WINNT=0x0601;WINVER=0x0601;_WIN32_IE=0x0603;WIN32_LEAN_AND_MEAN=1;DEVL=1;DBG=1;_DLL=1;_MT=1;NOMINMAX;INLINE_HRESULT_FROM_WIN32;_HAS_ITERATOR_DEBUGGING=0;CRYPT_OID_INFO_HAS_EXTRA_FIELDS;UNICODE;_UNICODE;_BIND_TO_CURRENT_ATL_VERSION=1;_BIND_TO_CURRENT_CRT_VERSION=1;_HAS_CPP0X=1;_ITERATOR_DEBUG_LEVEL=0;CRYPT_VERIFY_MESSAGE_PARA_HAS_EXTRA_FIELDS;_WINSOCK_DEPRECATED_NO_WARNINGS;NO_WCHAR_T=1;
Any clues of what is going on here and how I can workaround this?

Thanks!
Coordinator
Sep 24, 2015 at 7:45 PM
This looks similar to your previous failure: you're using _ITERATOR_DEBUG_LEVEL=0 here in debug mode (we use the default values for our NuGet package). You'll need to remove that for debug mode to work. Alternatively, you can compile the SDK yourself using the same preprocessor defines as your main project.

If the iterator debug level isn't the issue, I can't think of anything besides binary search :/. But it does sound like an ABI issue, so it's most likely amongst these or some other compiler settings you have.
Sep 29, 2015 at 7:29 PM
Thanks! The error was happening even without the _ITERATOR+DEBUG_LEVEL definition. However, it was a problem in memory management on my side. Thanks roschuma!