microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
913 stars 283 forks source link

PeerConnection.RemoveDataChannel throws Handle is not initialized #793

Open wenjunche opened 3 years ago

wenjunche commented 3 years ago

(First, Thanks for all your work on the great library!)

Describe the bug

Using .NET 4.7.2 in a simple console app, with one PeerConnetion and one DataChannel. Calling PeerConnection.RemoveDataChannel throws the following exception:

System.InvalidOperationException HResult=0x80131509 Message=Handle is not initialized. Source=mscorlib StackTrace: at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value) at Microsoft.MixedReality.WebRTC.DataChannel.DestroyNative() at Microsoft.MixedReality.WebRTC.PeerConnection.RemoveDataChannel(DataChannel dataChannel)

PeerConnection.DataChannelRemoved, if installed, is being called before the exception is thrown.

Expected behavior DataChannel is closed.

Environment MR-WebRTC: Latest stable 2.0.2 Platform: Windows 10.0.19042 Build 199042, .NET 4.7.2 Architecture: x86 Target device: Windows Desktop

Thanks