if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to register callback for changing profile state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}
if ((ConnectionError)ret != ConnectionError.None)
{
Log.Error(Globals.LogTag, "It failed to unregister callback for changing profile state, " + (ConnectionError)ret);
+ ConnectionErrorFactory.ThrowConnectionException(ret);
}
}
private void Destroy()
{
- Interop.ConnectionProfile.Destroy(ProfileHandle);
- ProfileHandle = IntPtr.Zero;
+ int ret = Interop.ConnectionProfile.Destroy(ProfileHandle);
+ if ((ConnectionError)ret == ConnectionError.None)
+ {
+ ProfileHandle = IntPtr.Zero;
+ }
+
}
internal void CheckDisposed()
if (_disposed)
return;
- Interop.WiFi.AP.Destroy(_apHandle);
- _apHandle = IntPtr.Zero;
+ Log.Info(Globals.LogTag, "WiFiAP Handle HashCode: " + _apHandle.GetHashCode());
+ int ret = Interop.WiFi.AP.Destroy(_apHandle);
+ if (ret == (int)WiFiError.None)
+ {
+ _apHandle = IntPtr.Zero;
+ }
_disposed = true;
}
/// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
public Task ConnectAsync()
{
- Log.Info(Globals.LogTag, "ConnectAsync");
+ Log.Info(Globals.LogTag, "ConnectAsync HashCode: " + _apHandle.GetHashCode());
if (_disposed)
{
throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)");