-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Runs in Windows Emulator, Throws System.NullReferenceException error in Android Emulator. Don't know where to start. #10249
Comments
Hello, where this exception occours? At build? I don't know if it is the same issue, but i got this error when i tried to navigate to a TabbedPage from a Shell Tab. On Windows everything was fine, but when i tried to run on Android, my app crashed. |
The first screen in the app never appears. I am only using shell. The build appears to complete, then the Android emulator opens up, then on the Android emulator, I see the standard background with standard Android links, then a screen with a blue background appears (like a blank page in my maui app), but then the first screen never appears and then the error is thrown. |
@tradegear if you disable hot reload does it work? Have you tried reducing your app down to a state where it runs? Like, just load a blank page then go from there? |
Hi @tradegear. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
No I have not tried reducing the app because removing anything breaks the app. Everything I have in here is part of the implemented pattern of session state, etc. |
There must be something that gets corrupted or out of sync between payload generated for Android and the emulator. Here is what I did to (temporarily?) side-step the issue, and why I do not believe it is an issue with my actual code:
|
Hi @tradegear. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@tradegear could you attach the two projects you mention so that we can take a closer look? |
This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
Description
I have a Maui app that runs fine in Windows mode. When I run it in an android emulator, I get a System.NullReferenceException. It does not break on any of my code. It just stops running and the Android emulator screen stays blue.
My app is pretty big and is already pointing to a webapi in Azure. Unless you specifically ask me, I'm not going to initially try to create a scrubbed version without credentials to upload for repro. Hopefully the info I am including here is sufficient, but you'll let me know.
Since it doesn't appear to be my code that is specifically in error, I don't know where to begin and I don't know what code to display for your review.
This reproduces every time, even after a fresh reboot of my dev PC or fresh launch of VS. I am on latest Windows 11 and VisualStudio 2022 17.3.4
I last attempted running in Android a couple weeks ago when I stopped due to problems (still unresolved, but hopefully sidestepped by publishing my webapi on Azure where there is a non local IP and ssl port 443 in place.) In fact, the new availability of this webapi in Azure is why I was once again going to run Android.
In lieu of source code, here is the call stack. The Android emulator window opens, but it never completes the load of my maui app. It blows up before the first page of my maui app appears. It doesn't indicate any line of my code, so this is a "black box" to me...
The Call Stack shows:
0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception
0x1A in Android.Runtime.JNINativeWrapper.unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5
0x1E in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:122,26
0x4E in Microsoft.Maui.MauiAppCompatActivity.OnCreate at D:\a_work\1\s\src\Core\src\Platform\Android\MauiAppCompatActivity.cs:32,4
0x11 in Android.App.Activity.n_OnCreate_Landroid_os_Bundle at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net6.0/android-31/mcw/Android.App.Activity.cs:2781,4
0x9 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:121,5
System.NullReferenceException
Message=Object reference not set to an instance of an object.
Here is my VisualStudio "Installed Products" info:
Microsoft Visual Studio Community 2022
Version 17.3.4
VisualStudio.17.Release/17.3.4+32901.215
Microsoft .NET Framework
Version 4.8.09032
Installed Version: Community
Visual C++ 2022 00476-80000-00000-AA531
Microsoft Visual C++ 2022
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASA Service Provider 1.0
ASP.NET and Web Tools 17.3.376.3011
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.3.376.3011
Azure App Service Tools v3.0.0
Azure Data Lake Tools for Visual Studio 2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 17.3.376.3011
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 4.3.0-3.22423.10+b35bb0baca1071d50cc4f8cf5a1a89e7cc112461
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft Azure Hive Query Language Service 2.6.5000.0
Language service for Hive query
Microsoft Azure Stream Analytics Language Service 2.6.5000.0
Language service for Azure Stream Analytics
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.3.20 (3f4cb00)
Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.5.40629.1 Commit Hash:3f5cc0329815af3ffb948f08857446d206a9af36
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.0.62207.04100
Microsoft SQL Server Data Tools
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.3.0-3.22423.10+b35bb0baca1071d50cc4f8cf5a1a89e7cc112461
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.1.0-beta.22363.4+1b94f89d4d1f41f20f9be73c76f4b229d4e49078
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.3.0.296 (d17-3@a0ff24b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.3.0.208 (remotes/origin/d17-3@e4f67afef)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.2.28 (9b3d244)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.0.0.0 (d17-3/030cd63)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6
Xamarin.iOS and Xamarin.Mac SDK 15.12.0.2 (87f98a75e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Here are some Xamarin logs:
2022-09-21_16-56-08.4992.monodroid.log
2022-09-21_16-56-08.4992.Ide.log
2022-09-21_17-20-59.22024.devicemanager.log
2022-09-21_17-20-49.22024.Ide.log
2022-09-21_17-20-49.22024.monodroid.log
2022-09-21_16-56-08.4992.monodroiddevices.log
2022-09-21_16-56-08.4992.HotReload.log
Steps to Reproduce
Run app in Windows. Runs fine.
Change emulator target from Windows to "Pixel 5 - API 32 (Android 12.1 - API 32)"
(note - I also tried a "fresh" Pixel 4 - API 32... emulator, and the error occurs the same way at the same time.)
The error occurs.
Running it without debug causes this output:
Loaded assembly: /data/data/com.companyname.mtrmauiclient/files/.override/Microsoft.Maui.Controls.Compatibility.dll [External]
Starting Android application ...
Android application is running.
Starting Android application ...
Android application is running.
Link to public reproduction project repository
n/a
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
android
Did you find any workaround?
run on windows to continue working on my dev project.
Relevant log output
I uploaded xamarin logs in previous window.
The text was updated successfully, but these errors were encountered: