Toast inside WeakReferenceMessenger event throws NULL
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Current Behavior
I´m trying to use a toast message inside a Handler for a weakreferencemessenger in my BaseViewModel. Calling await toast.Show results in a Null reference exception. I also tried to call it inside a Dispatch - same result.
Expected Behavior
the toast should be shown. Outside of a weakreferencemessenger callback it works without any problem.
Steps To Reproduce
Create a waekreference event. Create a handler for that event. Call toast inside the event.
Link to public reproduction project repository
Environment
- .NET MAUI CommunityToolkit: latest (8.0)
- OS: Android (11+)
- .NET MAUI: .net 7
Anything else?
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Toast in Android fragments showing null pointer expn
I am getting errors on few devices where I am trying to display a toast inside fragments. this toast is usually on retrofit...
Read more >Feed
This method checks if the event's sender is an instance of the ... the publishing can throw an error because inner frameworks and...
Read more >Dotnet Maui Net Maui 7.0 | PDF | Hyper V | Xamarin
You can't run a VM-accelerated emulator inside another VM, ... Invoking an unregistered event, with the InvokeEvents method, doesn't throw an. exception.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Toast is ui component, so it must be executed on ui thread: Can’t toast on a thread that has not called Looper.prepare()
Jup, when I call it on the main thread, everything works. Thanks!