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

Carousel - 'Timer' Causing ObjectDisposedException #3157

Closed
lswatt opened this issue Nov 24, 2021 · 7 comments
Closed

Carousel - 'Timer' Causing ObjectDisposedException #3157

lswatt opened this issue Nov 24, 2021 · 7 comments
Assignees
Labels
Status: Investigate Needs to investigate more to what can be done. Type: Possible Bug Needs to investigate more to see if it's an actual bug.

Comments

@lswatt
Copy link

lswatt commented Nov 24, 2021

We are using the carousel as a component and getting the following:

System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Timer'. at System.Timers.Timer.set_Enabled(Boolean value) at System.Timers.Timer.Start() at Blazorise.Carousel.ResetTimer() at Blazorise.Carousel.AnimationEnd(CarouselSlide slide) at Blazorise.Carousel.<>c__DisplayClass35_0.<<OnTransitionTimerEvent>b__0>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__9_0>d.MoveNext() --- End of stack trace from previous location --- at Blazorise.Carousel.OnTransitionTimerEvent(Object source, ElapsedEventArgs e) at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__127_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action1 callback, TState& state) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()

The current way we're reproducing this error is to just click around each page until it occurs again, we haven't been able to find 100% way to replicate.

@stsrki
Copy link
Collaborator

stsrki commented Nov 24, 2021

Can you tell us what version of Blazorise are you using?

@lswatt
Copy link
Author

lswatt commented Nov 24, 2021

0.9.5

@stsrki
Copy link
Collaborator

stsrki commented Nov 24, 2021

Tnx. We'll try to investigate.

@stsrki stsrki added Status: Investigate Needs to investigate more to what can be done. Type: Possible Bug Needs to investigate more to see if it's an actual bug. labels Nov 24, 2021
@stsrki stsrki added this to the 0.9.5 Support milestone Nov 24, 2021
@David-Moreira
Copy link
Contributor

What the heck?
"Basically as soon as you stop a timer, the internal System.Threading.Timer becomes available for Garbage Collection,
sometimes causing the elapsed event not to occur, or sometimes causing a disposed reference exception."

Is this why we have this weird code? haha
Sem Título

@David-Moreira
Copy link
Contributor

Hoping that the new "Timer" on NET6 will be much better and we can rework this. For now I think I am going to do the same that has been done with the Transition Timer... Otherwise I don't see any other options? Maybe acquire a lock to the Timer, that way it won't get gced?

@stsrki
Copy link
Collaborator

stsrki commented Nov 26, 2021

"Basically as soon as you stop a timer, the internal System.Threading.Timer becomes available for Garbage Collection,
sometimes causing the elapsed event not to occur, or sometimes causing a disposed reference exception."

what gives?! This feels like a major bug in .NET...

@stsrki stsrki closed this as completed Nov 28, 2021
@stsrki stsrki added this to Support Aug 3, 2024
@stsrki stsrki moved this to ✔ Done in Support Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Investigate Needs to investigate more to what can be done. Type: Possible Bug Needs to investigate more to see if it's an actual bug.
Projects
Archived in project
Development

No branches or pull requests

3 participants