http_client_config and Platform Toolset v120_xp

Dec 4, 2014 at 11:42 AM
I encountered an access violation when trying to use authentication for a client. Here is my code:
    http_client_config config;
    config.set_credentials(credentials(L"test", L"test"));

    http_client client(L"http://localhost", config);
The code is in a simple console application compiled with Platform Toolset v120_xp

When executing the last line that creates the client I get the following exception:
"Unhandled exception at 0x1001A34E (cpprest120d_xp_2_3.dll) in HttpCommClientTest.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC."

When compiling with toolset v120 is working fine.
When creating the client without specifying an http_client_config and with toolset v120_xp is working fine.

Are there some limitations I don't know about or this is a bug?
Dec 4, 2014 at 7:37 PM
Did you try defining CPPREST_TARGET_XP in your project Preprocessor Definitions?
Dec 5, 2014 at 1:43 PM
With that is working fine. Thank you for the tip.
Coordinator
Dec 5, 2014 at 5:40 PM
Hi cbogdan,

I think there actually is an issue here. Our NuGet package should take care of automatically defining CPPREST_TARGET_XP for you if you are using one of the toolsets targeting XP. I just took a look and it doesn't, so this is an issue that I'll fix.

I agree as well the documentation page for Windows should mention as well, incase you are not using our NuGet package. I'm keeping the issue you opened active until the changes have been made to correct in the future.

Thanks,
Steve