We really use the socket state to control the session, so there's no
need to also pass a CancellationToken around. The exception was being
caused when an unlucky callback happened after a session was disposed
and the callback tried to get a new token to check cancellation. If the
token source is already disposed, it can't provide a new token.
Also, remove some excessive logging and add more exception logging.
Using "SdkOnly" instead of "Full" doesn't increase the app size by even
1MB, and it no longer leads to seemingly random crashes due to some part
of the code being optimized out.
An `EventAwaiter` timeout now throws a `TimeoutException` instead of a
`TaskCanceledException`.
Disconnecting a micro:bit while subscribed for change notifications was
causing an exception because a notification was being triggered after
the socket closed. Fixing that led to an attempt to close the socket
after it was closed and set to `null`. That one was solved with a null
check.
For BT, connection is still not reliable but it's a step in the right
direction... I think. The socket lock is now held while opening the
RFCOMM channel, which is an awful long time to hold a lock, but really
no other thread should be messing with the socket during that time so I
guess it's the right thing to do. I also added debug printouts on the
RFCOMM event delegate.