TypeLoadException: LibVLCSharp.Shared.MediaPlayerElement.IVideoControl for any Forms WPF project
Summary
Loading Forms sample projects LocalNetwork (libvlcsharp-samples) & LibVLCSharp.Forms.Sample yields a TypeLoadException for LibVLCSharp.Shared.MediaPlayerElement.IVideoControl when running the WPF sample; the associated Android projects in the same solution run fine.
Minimal project and steps to reproduce
Create solution from LocalNetwork using following Forms sample projects:
- LocalNetwork
- LocalNetwork.Android
- LocalNetwork.WPF
or from LibVLCSharp.Forms:
- LibVLCSharp.Forms.Sample
- LibVLCSharp.Forms.Sample.Android
- LibVLCSharp.Forms.Sample.WPF
Run WPF as default project.
What is the current bug behavior?
Running Android samples run fine. Running LocalNetwork.WPF yields following exception:
System.Windows.Markup.XamlParseException
HResult=0x80131501
Message='The invocation of the constructor on type 'LocalNetwork.WPF.MainWindow' that matches the specified binding constraints threw an exception.' Line number '6' and line position '9'.
Source=PresentationFramework
StackTrace:
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
Inner Exception 1:
TypeLoadException: Could not load type 'LibVLCSharp.Shared.MediaPlayerElement.IVideoControl' from assembly 'LibVLCSharp, Version=3.4.5.0, Culture=neutral, PublicKeyToken=null'.
Running LibVLCSharp.Forms.Sample.WPF gives same TypeLoadException for LibVLCSharp.Forms.WPF.Sample.MainWindow.
Does it work on other plaforms? Does it work with the official VLC apps?
Android projects work fine.
Environment
- VS2019
- Windows 10
- LibVLCSharp 3.4.5
- VideoLAN.LibVLC.Android 3.2.0
- VideoLAN.LibVLC.Windows 3.0.11
Possible fixes
Possibly IVideoControl being set as Internal? Not sure why a MediaPlayerElement type exception as I was using VideoView?