unosquare / ffmediaelement

FFME: The Advanced WPF MediaElement (based on FFmpeg)
https://unosquare.github.io/ffmediaelement/
Other
1.17k stars 241 forks source link

System.NullReferenceException occurred in ffme.win.dll #612

Open Videstra opened 2 years ago

Videstra commented 2 years ago

Getting System.NullReferenceException during form initialization

During initializecomponent the IDE is throwing a nullreferenceexception from ffme.win.dll. The stacktrace shows some partial information with "at Unosquare.FFME.Platform.GUIContext..ctor() I have built a control using VB.NET and the control works in a much smaller test project just fine, but when I include the same control and call it the same way in a larger project I am getting the above error. I have wrapped InitializeComponent inside a try-catch, but it never falls into the catch while in the IDE. I can disable breaking for this error and things work correctly, but it seems dangerous do disable breaking for a nullreferenceexception as it disables it globally. Oddly the compiled code runs fine so it has to be some environment setting that is outside of my knowledge...

Issue Categories

Version Information

Sample Code

XAML

'<UserControl x:Name="BolinWPFPTZWindow1" x:Class="BolinWPFPTZWindow" ' xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ' xmlns:ffme="clr-namespace:Unosquare.FFME;assembly=ffme.win" ' xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ' xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ' xmlns:d="http://schemas.microsoft.com/expression/blend/2008" ' xmlns:local="clr-namespace:Videstra" ' mc:Ignorable="d" ' d:DesignHeight="450" d:DesignWidth="800" Loaded="BolinWPFWindow_Loaded"> ' ' <Canvas x:Name="GlassCanvas" HorizontalAlignment="Left" Height="450" Margin="-5,-5,0,-5" VerticalAlignment="Top" 'Width="800"> ' <ffme:MediaElement x:Name="Media" Background="Gray" LoadedBehavior="Play" UnloadedBehavior="Manual" 'Height="450" Width="800" /> ' ' '

vb

    Public Sub New()

        Try
            ' This call is required by the designer.
            InitializeComponent()              '<-Systemnullreferenceexception in ffme.win.dll

        Catch ex As Exception
            MsgBox(ex.Message)              '<-never gets here
        End Try
   End Sub

Command line ffplay

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.