LibVLC loading fails in WinForms Control Library project
Summary
LibVLC is not properly located when running a custom WinForms control in the test container executable.
Minimal project and steps to reproduce
https://github.com/mfkl/libvlcsharp/commit/91e298045eef4b877bebe87f11437f258e5d4e35
What is the current bug behavior?
When referencing the libvlcsharp project reference, the WinForms Control will try to load the netstandard build one and it can't so that fails. Referenced the netframework build manually for testing. This issue doesn't seem to appear when referencing the nuget.
The real issue is that when running a Library WinForms control, .NET will actually run your dll with a UserControlTestContainer.exe
, which causes our libvlc locating logic to fail because in
var assemblyLocation = Assembly.GetEntryAssembly()?.Location ?? Assembly.GetExecutingAssembly()?.Location;
GetEntryAssembly
returns
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\UserControlTestContainer.exe"
What is the expected correct behavior?
LibVLC is properly located in WinForms Custom control projects.
Does it work on other plaforms? Does it work with the official VLC apps?
Windows only I guess, maybe WPF as well.
Relevant logs and/or screenshots
Environment
- OS: windows
- Version latest
- Device: any
- LibVLC version and architecture 3.0.8.1
- LibVLCSharp version 3.4.3
I'm not sure this is worth the effort fixing tbh. Unlikely to be an issue with .NET Core as AFAIK this mode of execution is not supported.