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

MessageDialog on Android causes exception when user clicks outside dialog box #5114

Closed
2 of 24 tasks
vskotatko opened this issue Feb 2, 2021 · 9 comments
Closed
2 of 24 tasks
Labels
difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...)

Comments

@vskotatko
Copy link

Current behavior

MessageDialog on Android causes exception when user clicks outside dialog box. On UWP, outside clicks are ignored.

Build and test this minimal app:
github.com/vskotato/MinMessage

Expected behavior

How to reproduce it (as minimally and precisely as possible)

Workaround

None.

Environment

Nuget Package:

  • Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • Uno.SourceGenerationTasks
  • Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • Other:

Nuget Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

IDE:

  • Visual Studio 2017 (version: )
  • Visual Studio 2019 (version: 16.9.0 preview 3.0)
  • Visual Studio for Mac (version: )
  • Rider Windows (version: )
  • Rider macOS (version: )
  • Visual Studio Code (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

System.NullReferenceException
Message=Object reference not set to an instance of an object.

Stack Trace:
0xFFFFFFFFFFFFFFFF in System.Diagnostics.Debugger.Mono_UnhandledException_internal
0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Diagnostics/Debugger.cs:125,4

0x20 in Android.Runtime.DynamicMethodNameCounter.2

0x12 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:157,13

0x6 in System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__7_0 at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021,49

0xC in Android.App.SyncContext. at /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36,19

0xE in Java.Lang.Thread.RunnableImplementor.Run at /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36,6

0x8 in Java.Lang.IRunnableInvoker.n_Run at /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Java.Lang.IRunnable.cs:84,4

0x11 in Android.Runtime.DynamicMethodNameCounter.2

@vskotatko vskotatko added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Feb 2, 2021
@davidjohnoliver davidjohnoliver self-assigned this Feb 3, 2021
@francoistanguay francoistanguay added this to the 3.5 milestone Feb 3, 2021
@jeromelaban
Copy link
Member

Thank you for the report.

The issue is that the returned value of the ShowDialog method can return null when dismissing the dialog:

image

You'll need to ensure that you perform null checking on the return value.

In order to catch those exceptions, you'll need to check the Common Language Runtime Exceptions box here:

image

@vskotatko
Copy link
Author

While I would never argue against checking for null or providing exception handling, please be aware that the Uno behavior is explicitly different from UWP. As evidence, please look at this example, provided by Microsoft:
CompletedCallback.xaml.cs

Notice that they do not check for null and directly dereference the return value. Further, the documentation gives no mention of a possible null return value.

@jeromelaban jeromelaban reopened this Feb 3, 2021
@jeromelaban
Copy link
Member

Indeed, the behavior is not the same, I'll keep the issue opened. In the meantime, you can validate for null as a workaround.

@vskotatko
Copy link
Author

Yes, I verified that checking for null is a workaround.

@davidjohnoliver davidjohnoliver modified the milestones: 3.5, 3.6 Feb 4, 2021
@jeromelaban jeromelaban added the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Feb 15, 2021
@davidjohnoliver davidjohnoliver modified the milestones: 3.6, 3.7 Mar 17, 2021
@davidjohnoliver davidjohnoliver removed this from the 3.7 milestone Apr 20, 2021
@davidjohnoliver davidjohnoliver added the project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...) label Apr 20, 2021
@davidjohnoliver davidjohnoliver removed their assignment Apr 21, 2021
@MartinZikmund MartinZikmund added area/eu difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. triage/untriaged Indicates an issue requires triaging or verification labels Jun 3, 2021
@Youssef1313
Copy link
Member

I think fixing #1950 (being done in #6654) will also fix this issue. Can you confirm @jeromelaban ?

@jeromelaban
Copy link
Member

@Youssef1313 it may, let's retry with the sample once merged.

@Youssef1313
Copy link
Member

@vskotatko Can you try with the latest dev version? (currently 3.10.0-dev.685)

@vskotatko
Copy link
Author

@Youssef1313 Eventually, I can try, but it will be a while. Thanks for addressing this.

@jeromelaban
Copy link
Member

Let's close this issue. You can reopen if it still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/starter 🚀 Categorizes an issue for which the difficulty level is reachable by newcomers kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...)
Projects
None yet
Development

No branches or pull requests

6 participants