Access Violation Exception when try to dispose VideoView
Summary
After stopping media player, and disposing media and media player, attempt to dispose VideoView throws AccessViolationException.
Minimal project and steps to reproduce
Here is the code
Before build you should enter necessary data for stream in ShellViewModel.cs. After start of application you should click on Open stream button. Full screen window with stream should be opened after click. Placing the mouse in upper left corner will show you close and move to grid buttons. Clicking on close or move to grid button should throw an exception.
What is the current bug behavior?
Calling dispose on VideoView throws an AccessViolationException.
What is the expected correct behavior?
Window with player should close and VideoView should be disposed.
Does it work on other plaforms? Does it work with the official VLC apps?
Not tested.
Relevant LibVLC logs and/or screenshots
Only this:
An unhandled exception of type 'System.AccessViolationException' occurred in LibVLCSharp.dll.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Environment
- OS: Windows 10 Pro
- Version 21H1
- Device: desktop PC
- LibVLC version and architecture VideoLan.LibVLC.Windows 3.0.16
- LibVLCSharp version LibVLCSharp.WPF 3.6.5
Possible fixes
Line no. 199 in CameraStreamViewModelAbstract.cs cause the issue.