Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.NullReferenceException: Object reference not set to an instance of an object. #49

Closed
mohanadasari opened this issue Jun 1, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@mohanadasari
Copy link

Getting this exception while using spinner control. had downloaded the source code and fixed issue locally, how do we put the fix as part of upcoming release. Fix details,
Filename: LottieSharp-master\LottieSharp\WpfSurface\D2dControl.cs
on line number 135 inside method "OnIsFrontBufferAvailableChanged" added null check as follows if (d3DSurface != null && d3DSurface.IsFrontBufferAvailable)

Exception Details: Unhandled exception
System.NullReferenceException: Object reference not set to an instance of an object.
at LottieSharp.WpfSurface.D2dControl.OnIsFrontBufferAvailableChanged(Object sender, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyPropertyChangedEventHandler.Invoke(Object sender, DependencyPropertyChangedEventArgs e)
at System.Windows.Interop.D3DImage.IsFrontBufferAvailablePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.Freezable.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
at System.Windows.Interop.D3DImage.SetIsFrontBufferAvailable(Object isAvailableVersionPair)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at Sncr.Cloud.UI.App.Main()
An unhandled exception of type 'System.NullReferenceException' occurred in WindowsBase.dll
Object reference not set to an instance of an object.

@OmidID OmidID added the bug Something isn't working label Jun 8, 2021
@mohanadasari
Copy link
Author

@OmidID It will be great if we we come to know about expected release for the issue.

@hristowwe
Copy link

I got same problem
image

@saklanmazozgur
Copy link

I have the same problem, did you find a solution?

@hristowwe
Copy link

hristowwe commented Sep 30, 2021

I have the same problem, did you find a solution?

No you can use MediaElement or this lib https://github.com/XamlAnimatedGif/WpfAnimatedGif

@jm-parent
Copy link

Hey !

Had the same issue.

1 - Put your json in solution
image

2 - Check settings
image

3 - Check your .csproj and find the new line
image

4 - Update your xaml
image

Thats how i fix mine :)

Hope it will help you too

@saklanmazozgur
Copy link

You're great, it worked for me, thank you.

@quicoli quicoli closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants