dotnet / dotnet/aspnetcore

[Signalr-Cpp-Client] Cannot use start method using DLL with static linking

Open
#60,309 3 comments 0 reactions 0 assignees View on GitHub
area-signalr
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

When calling the `start` method on `hub_connection` I catch an exception through a callback function with the following content: `set_fail_handler: 2: Underlying Transport Error`. As I understand it, this is most likely related to the fact that I am using a DLL file with statically linked vcpkg packages for `microsoft-signalr`.

A more detailed log with trace level set to verbose:
```
2025-02-11T07:24:53.687Z [verbose ] acquired lock in start()
2025-02-11T07:24:53.687Z [verbose ] disconnected -> connecting
2025-02-11T07:24:53.687Z [verbose ] released lock in start()
2025-02-11T07:24:55.754Z [info ] [websocket transport] connecting to: ws://localhost:5122/scale?id=qZR34PjhRw1uoHHASgML5w
2025-02-11T07:24:55.758Z [error ] [websocket transport] exception when connecting to the server: set_fail_handler: 2: Underlying Transport Error
2025-02-11T07:24:55.759Z [error ] transport could not connect due to: set_fail_handler: 2: Underlying Transport Error
2025-02-11T07:24:55.759Z [error ] connection could not be started due to: set_fail_handler: 2: Underlying Transport Error
2025-02-11T07:24:55.759Z [verbose ] connecting -> disconnected
```

Notably, the server logs where the client connects indicate that a new connection was created:
```
[15:24:55 DBG] 1 candidate(s) found for the request path '/scale/negotiate'
[15:24:55 DBG] Request matched endpoint '/scale/negotiate'
[15:24:55 DBG] Static files was skipped as the request already matched an endpoint.
[15:24:55 INF] Executing endpoint '/scale/negotiate'
[15:24:55 DBG] New connection Ri7NYPIjmMPqdUT_UoRggg created.
[15:24:55 DBG] Sending negotiation response.
[15:24:55 INF] Executed endpoint '/scale/negotiate'
[15:24:55 INF] Request finished HTTP/1.1 POST http://localhost:5122/scale/negotiate?negotiateVersion=1 - 200 316 application/json 5.7812ms
```

I created a test client using an executable, and there the connection, message sending, and receiving work perfectly.

### Expected Behavior

After using `start` method `hub_connection` state would be changed from `signalr::connection_state::disconnected` to `signalr::connection_state::connected`.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.