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
Windows: Connect -> ConnectionLost -> Reconnect #849
Windows: Connect -> ConnectionLost -> Reconnect #849
Conversation
@CodeMusher Does this fix the problem for you? |
@janusw I’ll try to check that tomorrow! |
@janusw @AskBojesen For some reason the line below in the Adapter.cs for Windows throws System.InvalidCastException |
What can i say, it works now... i think VS has a bug in applying these nugets with similar version numbers... but what do i know... |
@axa88 I’ve not tested in the real application either, but if it is like you are describing it regarding the events then it’s not good. |
Now I've tried the PR a step up in the abstraction chain, that is my test application. It seems like I get both Adapter.DeviceConnected and Adapter.DeviceConnectionLost when I power cycle my peripheral. In my setup it seems to work! |
The code has been in there for a while - but it is new to 3.1 vs 3.0. It is bad if an exception is thrown for the GetConnectionParameters(), because then the HandleConnectedDevice(connectedDevice) is not called (see below image) |
Huh, that line as such looks rather innocent, and I don't really see why it would generate an InvalidCastException. However @CodeMusher Two questions:
|
@janusw You're right that it must be the runtime that messes it up
|
The tests I performed yesterday were power cycling the peripheral. These tests gave me Today I tried to initiate disconnect from the app instead. I thought that would invoke a Adapter.DeviceDisconnected. |
you need runtime check if running on Windows 10, or you must use another target than 10.0.22621 I have made a runtime check as custom action for the installer for our desktop app to avoid running on eg. 10.0.19045
|
@CodeMusher : I get Adapter.DeviceDisconnected when testing with the winconsole client... You Write: Disconnecting from app - which app on which platform? See the first lines in the attached demolog.txt Running: Connect -> Disconnect
|
@AskBojesen > you need runtime check if running on Windows 10, or you must use another target than 10.0.22621 Unfortunately Windows has no check for runtime - you simply get exceptions has you saw!
Ok, I'll keep that in mind, missed that one. |
Thanks for the info. This indeed confirms my suspicion.
Well, I think the library should better guard the version-dependent code by a runtime check and only execute it if it's supported (see https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/version-adaptive-apps). For |
@AskBojesen > Disconnecting from app - which app on which platform? It is my test app running on top of your library on Windows. I've checked the old code and it seems like it does something else than how it is done in the WinConsole. |
I agree - that it is dangerous as it is now - I got a nasty surprise myself trying to run the desktop app on Windows 10. |
@CodeMusher , @axa88 : Can you please confirm, that the original issue for this PR is solved? Original issue: not connection lost of lost without client request |
Note: open issues not fixed in this PR:
When this PR is approved and merged, then I will look into the three issues above. |
@AskBojesen I can report the first connect/disconnect/lost cycle does appear to work, just not anything further. |
I believe my initial issue is solved by this.
… 14 maj 2024 kl. 22:21 skrev axa88 ***@***.***>:
@CodeMusher , @axa88 : Can you please confirm, that the original issue for this PR is solved?
Original issue: not connection lost of lost without client request
@AskBojesen
Im unable to confirm anything regarding this issue. With this build it doesn't take much more than 2 connect/disconnect cycles before my device is left in an unusable state which will no longer connect/disconnect as reported elsewhere.
I can report the first connect/disconnect/lost cycle does appear to work. But just not anything past that.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
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.
I believe my initial issue is solved by this.
Alright, then let's merge it. The modification of the library itself is rather simple, after all, and ok with me.
Perhaps consider closing #717 as well, arguably qualifies to be closed already but surely after you address the above... |
To fix: #826
demolog.txt