-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix missing signatures #51
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…fix-missing-signatures
jenow
approved these changes
Apr 1, 2020
Codecov Report
@@ Coverage Diff @@
## 2-dev #51 +/- ##
==========================================
- Coverage 83.09% 82.19% -0.90%
==========================================
Files 34 34
Lines 1644 1674 +30
Branches 196 194 -2
==========================================
+ Hits 1366 1376 +10
- Misses 255 275 +20
Partials 23 23
Continue to review full report at Codecov.
|
…rp into fix-missing-signatures
Aschen
approved these changes
Apr 8, 2020
Merged
scottinet
added a commit
that referenced
this pull request
Apr 9, 2020
# [2.0.2](https://github.com/kuzzleio/sdk-csharp/releases/tag/2.0.2) (2020-04-09) #### Bug fixes - [ [#51](#51) ] Fix missing signatures ([scottinet](https://github.com/scottinet)) ---
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The WebSocket class was abstracting the
System.net.WebSockets.ClientWebSocket
object by storing it in adynamic
variable.This was made to allow mocking the ClientWebSocket class (which is final and thus cannot be extended) via duck typing, using a custom
IClientWebSocket
interface 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.