maui icon indicating copy to clipboard operation
maui copied to clipboard

Empty NavigationPageRenderer crashes the app

Open BlueRaja opened this issue 1 year ago • 2 comments

Description

Simply using an empty NavigationPageRenderer will crash the app

Steps to Reproduce

public class MyNavigationPageRenderer : NavigationPageRenderer
{
    public MyNavigationPageRenderer(Context context) : base(context) {}
}
var builder = MauiApp.CreateBuilder();
builder
    .UseMauiApp<App>()
    .UseMauiCompatibility()
    .ConfigureMauiHandlers((handlers) => handlers.AddCompatibilityRenderer(typeof(NavigationPage), typeof(MyNavigationPageRenderer)));

Expected results: App starts

Actual results:

System.MissingMethodException: 'Method not found: int .Layout.get_toolbar()'

in Android.Runtime.RuntimeNativeMethods.monodroid_debugger_unhandled_exception in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:13,5 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:368,26 in Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat.NavigationPageRenderer.SetupToolbar in Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat.NavigationPageRenderer.OnElementChanged in Microsoft.Maui.Controls.Compatibility.Platform.Android.VisualElementRenderer<Microsoft.Maui.Controls.NavigationPage>.SetElement in Microsoft.Maui.Controls.Compatibility.Platform.Android.VisualElementRenderer<Microsoft.Maui.Controls.NavigationPage>.Microsoft.Maui.Controls.Compatibility.Platform.Android.IVisualElementRenderer.SetElement in Microsoft.Maui.Controls.Compatibility.RendererToHandlerShim.SetVirtualView in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IView,Android.Views.View>.SetVirtualView at D:\a_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4 ...

Link to public reproduction project repository

No response

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

Nope. I'm still trying to figure out how to implement the equivalent functionality using handlers.

Relevant log output

No response

BlueRaja avatar Mar 10 '24 11:03 BlueRaja

Has anyone figure this out? I'm having the same problem.

think-mcunanan avatar Mar 13 '24 08:03 think-mcunanan

Uh, no. A repro was provided. The "needs repro" tag is incorrect.

BlueRaja avatar Mar 20 '24 01:03 BlueRaja

Please, please, have a look at this. We are stuck with our XF->MAUI migration :-(

MAICO-Diagnostics avatar Jun 12 '24 11:06 MAICO-Diagnostics

Will there be any reaction from the developers? Do you follow the same rule as it was with Xamarin: "If we can't fix something, we keep quiet about it"????

AndriyGlodan avatar Oct 11 '24 21:10 AndriyGlodan

look like the repro was deleted

pictos avatar Oct 12 '24 00:10 pictos

look like the repro was deleted

It was not. It's under "steps to reproduce".

It's also trivial to reproduce just from the description, because it's an entire, major feature that literally does not work at all. This bug report is not "there is an edge case that does not work", it's "this feature never works, even in the simplest, most trivial case."

BlueRaja avatar Oct 12 '24 00:10 BlueRaja

@BlueRaja repro, is a runnable project that reproduces the issue. Friendly asking... If it's trivial why not provide it and help us to help you?

BTW, I'm a community contributor and don't work for maui team

pictos avatar Oct 12 '24 00:10 pictos