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

.net 9 maui Shell.Current.GotoAsync("..") app crash with debugger is attached exception on windows when back from a page that implements map control #26289

Closed
MahmoudAlEssawi opened this issue Nov 30, 2024 · 8 comments
Labels
i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@MahmoudAlEssawi
Copy link

Description

After upgrading to .net 9
and CommunityToolkit.Maui.Maps nuget to 2.0.4

when navigating back from a page that implements a map control

this happens on windows only

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif

Steps to Reproduce

setup the CommunityToolkit.Maui.Maps nuget version: 2.0.4

Create a page.

add map control,

run on Windows machine

try navigating to this page then navigate back.

Link to public reproduction project repository

No response

Version with bug

9.0.10 SR1

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

8.0.91 SR9.1

Affected platforms

Windows

Affected platform versions

Windows 11

Did you find any workaround?

No

Relevant log output

@MahmoudAlEssawi MahmoudAlEssawi added the t/bug Something isn't working label Nov 30, 2024
@FaithfulDev
Copy link
Contributor

Link to public reproduction project repository:
https://github.com/FaithfulDev/MapGoBackBugMinimal

I'm getting this exception:

PlatformView cannot be null here

at Microsoft.Maui.Handlers.ViewHandler`2.get_PlatformView()
at CommunityToolkit.Maui.Maps.Handlers.MapHandlerWindows.DisconnectHandler(FrameworkElement platformView)
at Microsoft.Maui.Handlers.ViewHandler`2.OnDisconnectHandler(FrameworkElement platformView)
at Microsoft.Maui.Handlers.ViewHandler.OnDisconnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler()
at Microsoft.Maui.ViewExtensions.DisconnectHandlers(IView view)
at Microsoft.Maui.Controls.Page.<SendNavigatedFrom>b__111_0()
at Microsoft.Maui.Platform.FrameworkElementExtensions.<>c__DisplayClass11_0.<OnUnloaded>b__2(Object _, RoutedEventArgs __)
at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler.EventState.<GetEventInvoke>b__1_0(Object sender, RoutedEventArgs e)
at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)

Is this your exception as well?

@FaithfulDev
Copy link
Contributor

It's probably better for you to ask in the Community Toolkit Maui project for help:
https://github.com/CommunityToolkit/Maui

@MahmoudAlEssawi
Copy link
Author

Link to public reproduction project repository: https://github.com/FaithfulDev/MapGoBackBugMinimal

I'm getting this exception:

PlatformView cannot be null here

at Microsoft.Maui.Handlers.ViewHandler`2.get_PlatformView()
at CommunityToolkit.Maui.Maps.Handlers.MapHandlerWindows.DisconnectHandler(FrameworkElement platformView)
at Microsoft.Maui.Handlers.ViewHandler`2.OnDisconnectHandler(FrameworkElement platformView)
at Microsoft.Maui.Handlers.ViewHandler.OnDisconnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler()
at Microsoft.Maui.ViewExtensions.DisconnectHandlers(IView view)
at Microsoft.Maui.Controls.Page.<SendNavigatedFrom>b__111_0()
at Microsoft.Maui.Platform.FrameworkElementExtensions.<>c__DisplayClass11_0.<OnUnloaded>b__2(Object _, RoutedEventArgs __)
at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler.EventState.<GetEventInvoke>b__1_0(Object sender, RoutedEventArgs e)
at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)

Is this your exception as well?

Visual studio doesn't generate any log report for the exception. just crash with debugger is attached

@FaithfulDev
Copy link
Contributor

FaithfulDev commented Dec 1, 2024

Visual studio doesn't generate any log report for the exception. just crash with debugger is attached

When your Debugger stops at System.Diagnostics.Debugger.Break(); in the UnhandledException event handler, you can inspect the event args e to see the exception that was unhandled.

@MahmoudAlEssawi
Copy link
Author

Thanks for your help:

Yes the error is the same as you get:

PlatformView cannot be null here

at Microsoft.Maui.Handlers.ViewHandler2.get_PlatformView() at CommunityToolkit.Maui.Maps.Handlers.MapHandlerWindows.DisconnectHandler(FrameworkElement platformView) at Microsoft.Maui.Handlers.ViewHandler2.OnDisconnectHandler(FrameworkElement platformView)
at Microsoft.Maui.Handlers.ViewHandler.OnDisconnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler()
at Microsoft.Maui.ViewExtensions.DisconnectHandlers(IView view)
at Microsoft.Maui.Controls.Page.b__111_0()
at Microsoft.Maui.Platform.FrameworkElementExtensions.<>c__DisplayClass11_0.b__2(Object _, RoutedEventArgs __)
at WinRT._EventSource_global__Microsoft_UI_Xaml_RoutedEventHandler.EventState.b__1_0(Object sender, RoutedEventArgs e)
at ABI.Microsoft.UI.Xaml.RoutedEventHandler.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr e)

@MahmoudAlEssawi
Copy link
Author

I created an issue in the community toolkit as it related to it.
#2366

@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed platform/windows 🪟 i/regression This issue described a confirmed regression on a currently supported version labels Dec 2, 2024
@kevinxufei
Copy link

kevinxufei commented Dec 2, 2024

I can repro this issue at Windows platform on the latest 17.13 Preview 1(9.0.0 & 9.0.100),but the PlatformView cannot be null exception does not exist in 8.0.91 & 8.0.100.
Image

@tj-devel709
Copy link
Member

Thanks for creating this issue. Since there is an issue created in the Maui Community Toolkit above, I will close this one here. If this is not resolved with the Maui Community Toolkit, feel free to reopen this issue or create a new one and link this issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants