Removing/Adding the VideoView throws an Exception
Summary
This bug relates to UpdateSize() method from VideoView class. It throws a NullReferneceException when the VideoView is unloaded/removed from the UI and gets added again even if in the same view. VideoView.cs
Minimal project and steps to reproduce
You can have a look at this sample: https://github.com/ahmar20/vlc-test/tree/master/VLC-Test My sample also includes a nuget package named YoutubeExplode. You can install the Nuget to avoid errors.
- First you can play the video, although it is not needed. Just press Enter on the VideoID TextBox.
- Then use the Remove button to remove the VideoView from the UI and use the Add button to add it back
- Notice the Exeption
What is the current bug behavior?
An exception is thrown.
What is the expected correct behavior?
The VideoView should be manipulatable from the UI.
Relevant logs and/or screenshots
Environment
- OS: Windows
- Version v18875
- Device: Desktop
- LibVLC version and architecture x86
- LibVLCSharp version 3.1.0
Possible fixes
I think the possible fix is somehwere within the DestroySwapChain() method from VideoView.cs. I believe once the Element gets removed from the View it unloads it and nullifies everything but when it gets added some values, possibly, swap chain values dont get added and that is where the Exception is thrown.