-
Notifications
You must be signed in to change notification settings - Fork 1
Fix missing signatures (SDK v1) #50
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
Conversation
rolljee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved when CI pass
Codecov Report
@@ Coverage Diff @@
## 1-dev #50 +/- ##
==========================================
- Coverage 83.24% 82.35% -0.89%
==========================================
Files 34 34
Lines 1665 1695 +30
Branches 200 198 -2
==========================================
+ Hits 1386 1396 +10
- Misses 257 277 +20
Partials 22 22
Continue to review full report at Codecov.
|
# [1.0.1](https://github.com/kuzzleio/sdk-csharp/releases/tag/1.0.1) (2020-04-02) #### Bug fixes - [ [#50](#50) ] Fix missing signatures (SDK v1) ([scottinet](https://github.com/scottinet)) ---
Description
The WebSocket class was abstracting the
System.net.WebSockets.ClientWebSocketobject by storing it in adynamicvariable.This was made to allow mocking the ClientWebSocket class (which is final and thus cannot be extended) via duck typing, using a custom
IClientWebSocketinterface which reproduces parts of the ClientWebSocket API.Problem is: it seems that the Visual Studio C# linker is smart enough to remove unused functions from compiled applications, but it's unable to detect functions used through dynamic variables.
This made ClientWebSocket functions stripped from applications using our SDK, making it useless with that protocol.
This PR fixes this situation by making our WebSocket protocol implementation use only objects implementing our IClientWebSocket interface, completely removing duck typing.
I added a humble object creating and wrapping ClientWebSocket instances to make that class compatible with our custom interface. That humble object explicitly uses ClientWebSocket functions, forcing the C# linker to keep them in the compiled product.
Mocking is made by injecting a custom mock objecting implementing that interface.
Other changes
How to review
The actual fix is in the Kuzzle/Protocol/WebSocket.cs file (and its unit test counterpart). All other changes are about fixing warnings.