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

[BUG] Cancel being called on a disposed CancellationTokenSource #2310

Open
2 tasks done
matt-bartholomew opened this issue Nov 1, 2024 · 11 comments · May be fixed by #2344
Open
2 tasks done

[BUG] Cancel being called on a disposed CancellationTokenSource #2310

matt-bartholomew opened this issue Nov 1, 2024 · 11 comments · May be fixed by #2344
Labels
bug Something isn't working

Comments

@matt-bartholomew
Copy link

matt-bartholomew commented Nov 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The app is a fairly basic app that renders questionnaires (from JSON) into popups, or pages, that can be filled out. This is used as a package in other apps we have. Inside of the code is a sample app. When you load up a form and click into a textbox, the app crashes, with the following being printed to the console. From the best I can tell, it looks like Cancel() is called on a disposed cancellationtokensource. The app uses validation behaviors based on the question type.

System.ObjectDisposedException: 'Loading...'

System.ObjectDisposedException: 'The CancellationTokenSource has been disposed.'

[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: The CancellationTokenSource has been disposed.
[mono-rt] at System.Threading.CancellationTokenSource.ThrowIfDisposed()
[mono-rt] at System.Threading.CancellationTokenSource.Cancel(Boolean throwOnFirstException)
[mono-rt] at System.Threading.CancellationTokenSource.Cancel()
[mono-rt] at CommunityToolkit.Maui.Behaviors.ValidationBehavior.ResetValidationTokenSource(CancellationTokenSource newTokenSource)
[mono-rt] at CommunityToolkit.Maui.Behaviors.ValidationBehavior.UpdateStateAsync(VisualElement view, ValidationFlags flags, Boolean isForced, Nullable`1 parentToken)
[mono-rt] at CommunityToolkit.Maui.Behaviors.ValidationBehavior.OnViewPropertyChanged(VisualElement sender, PropertyChangedEventArgs e)
[mono-rt] at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
[mono-rt] at Android.App.SyncContext.<>c__DisplayClass2_0.b__0() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:line 36
[mono-rt] at Java.Lang.Thread.RunnableImplementor.Run() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:line 37
[mono-rt] at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.Lang.IRunnable.cs:line 84
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 22

Expected Behavior

You should be able to open the form, click into a textbox, and fill out the form w/o issue.

Steps To Reproduce

  1. Open solution, navigate to main branch, and build and run for Android.
  2. Once app loads, select button "Fill Out Form".
  3. Click into the "Number of Milk Crates Delivered" entry and app will crash.

Link to public reproduction project repository

https://github.com/matt-bartholomew/MobileForms

Environment

  • .NET MAUI CommunityToolkit: 9.0.3
  • OS: Android XT3 running Android 9
  • .NET MAUI: 9.0.0-rc.1.24453.9

Anything else?

No response

@matt-bartholomew matt-bartholomew added bug Something isn't working unverified labels Nov 1, 2024
@bijington
Copy link
Contributor

Do you see this issue when using .NET 8.0? We don't officially support .NET 9.0 yet

@matt-bartholomew
Copy link
Author

Do you see this issue when using .NET 8.0? We don't officially support .NET 9.0 yet

I'm targeting .net 8.
Image
Image

@bijington
Copy link
Contributor

But you are depending on .NET 9.0 MAUI libraries...

@matt-bartholomew
Copy link
Author

Image
When I downgrade the packages to what's shown in the picture the issues still persist.

@pictos
Copy link
Member

pictos commented Nov 4, 2024

@matt-bartholomew your repro url gives a 404. Can you fix that?

Copy link
Contributor

Hi @matt-bartholomew! We have added the needs reproduction label to this issue, which indicates that we are unable to take further action until you provide a reproduction sample that we can use to reproduce + fix your bug. In accordance with the Reporting a bug section of our Contributing.md that you confirmed reading before you submitted this Issue, we ask that every Issue author provide a link to an open-source repository containing the reproduction sample app. This issue will be closed automatically in 5 days if we do not receive a reproduction sample from you. Please feel free to re-open this Issue once you have provided a reproduction sample.

@matt-bartholomew
Copy link
Author

Hi @matt-bartholomew! We have added the needs reproduction label to this issue, which indicates that we are unable to take further action until you provide a reproduction sample that we can use to reproduce + fix your bug. In accordance with the Reporting a bug section of our Contributing.md that you confirmed reading before you submitted this Issue, we ask that every Issue author provide a link to an open-source repository containing the reproduction sample app. This issue will be closed automatically in 5 days if we do not receive a reproduction sample from you. Please feel free to re-open this Issue once you have provided a reproduction sample.

I have updated the reproduction link with a public repo (the original one was private - my bad!). Use https://github.com/matt-bartholomew/MobileForms

@pictos
Copy link
Member

pictos commented Nov 5, 2024

could confirm the issue

@matt-bartholomew
Copy link
Author

@bijington I just wanted to check in and see if you had any thoughts.

@matt-bartholomew
Copy link
Author

@pictos Do you have any insight into what the process and/or timeline is like for getting assistance with these bugs? I've never put in a bug before, so I don't really know what the process/timeline looks like, and this is a pretty critical fix for my company.

@bijington
Copy link
Contributor

@matt-bartholomew we don't usually put any timelines on things because the contributors work on this in their spare time. If there hasn't been any progress I doubt anyone has had a chance to look into it.

If it is a critical issue for you/your company then perhaps you would consider contributing in some way towards the fix? We accept PRs and any other assistance

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
3 participants