Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignalR C++ Client read access violation from signalr_client_config destructor #43617

Closed
ChrisHawkridge opened this issue Aug 29, 2022 · 4 comments
Labels
area-signalr Includes: SignalR clients and servers

Comments

@ChrisHawkridge
Copy link

Hi there,

I am getting a read access violation as soon as an instance of signalr_client_config goes out of scope.
I pulled the microsoft-signalr package from vcpkg and I am using Visual Studio 2022.

To Reproduce

I created a blank windows console app with the following code.

#include <iostream>
#include "signalrclient/hub_connection.h"

int main()
{
    std::cout << "Hello World!\n";

    {
        std::map<std::string, std::string> http_headers;
        http_headers.insert({ "Authorization", "" });

        signalr::signalr_client_config config;
        config.set_http_headers(http_headers);
    }

    std::cout << "finished.\n";
}
@javiercn javiercn added the area-signalr Includes: SignalR clients and servers label Aug 29, 2022
@BrennanConroy
Copy link
Member

These kinds of issues can occur if you use different compilers/compiler versions for different parts of your application.

What compiler did you use via vcpkg to build microsoft-signalr? And what compiler are you using with VS 2022?

@ChrisHawkridge
Copy link
Author

ChrisHawkridge commented Aug 30, 2022

Hi Brennan, I'm on windows and using the default compiler in both cases, so that would be the MSVC compiler if I'm not mistaken.
I am using the v143 Platform Toolset in VS 2022 and I created a custom triplet which is a copy of x64-windows but with set(VCPKG_PLATFORM_TOOLSET v143) added.

@BrennanConroy
Copy link
Member

Ah, the issue is that your application needs to define USE_CPPRESTSDK, that requirement will go away in the future.

@ChrisHawkridge
Copy link
Author

Thanks, all looks good now.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

3 participants