-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Bug] Maui-Blazor Project Template crashes in Release Mode #2246
Comments
@aokocax does this also happen with a regular .NET MAUI app (no Blazor)? |
Nope, it only crashes maui-blazor template. .Net Maui App works perfectly in release mode. When I comment out this section in Maui-Blazor template Maui-blazor app also works in release mode. |
Thanks for the update, we will investigate. |
Thanks @Eilon , |
I also just ran across this problem and was able to reproduce it. The workaround mentioned #2246 (comment) seems to run without crashing, however, I cannot navigate to any pages because of it. |
It may be totally unrelated, but we have seen that exception on startup in Forms - see xamarin/Xamarin.Forms#8301 and xamarin/Xamarin.Forms#6703. |
@Eilon any updates in this issue? Could this be fixed in Preview9? |
I also tried on mac but same problem persists. I think there is a problem on the android side, probably related to proguard. |
Unfortunately the problem still persists, not fixed in rc2 either. |
Thank you very much @Asyvix |
Reopening because the availability of a workaround isn't the quality bar we're going for :) This needs to be fixed. |
Same problem with MAUI preview 12, 21/01/2022 |
I think that the templates should probably include "Release" settings that override the defaults for architecture types, linker settings, and more. The UI for Xamarin.iOS/Android projects do this normally, but the templates ship with defaults. I think we just need to sync with those teams to configure the templates. 1.) @jonathanpeppers @Redth @dalexsoto thoughts as these apply to ios/android project templates as well |
If the workaround is I don't follow what would change in the templates here? We should figure out what the issue is? The crash mentioned here: #4262
I'll try to repro and see if we can find out the cause. It kind of looks like |
…asses Fixes: dotnet/maui#2246 Fixes: dotnet/maui#4262 Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1447865 `dotnet new maui-blazor` crashes in Release mode with: Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) It turns out that `Java.IO.InputStream.GetReadHandler()` was linked away. So we need to preserve: <linker> <assembly fullname="Mono.Android"> <type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" /> Long-term, we should consider reworking `mono.android.jar`, so that the linker *knows* about any C# methods called from Java from this library. For now, let's preserve a few additional types that could fall into the same issue: <type fullname="Android.Runtime.InputStreamAdapter" preserve="methods" /> <type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" /> <type fullname="Android.Runtime.XmlResourceParserReader" preserve="methods" /> <type fullname="Android.Runtime.XmlPullParserReader" preserve="methods" /> <type fullname="Android.Runtime.XmlReaderResourceParser" preserve="methods" /> <type fullname="Android.Runtime.XmlReaderPullParser" preserve="methods" /> This should hopefully fix issues like this, and hopefully not regress app size that much.
We should hopefully have this fixed in the next MAUI preview. The most precise workaround is to create a <linker>
<assembly fullname="Mono.Android">
<type fullname="Android.Runtime.InputStreamAdapter" preserve="methods" />
<type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" />
</assembly>
</linker> Put this in your <EmbeddedResource Include="ILLink.Descriptors.xml">
<LogicalName>ILLink.Descriptors.xml</LogicalName>
</EmbeddedResource> Details about the file format here. |
This fix wont work as expected. |
@SilverioMiranda did you try to Clean or Rebuild? What you’re describing sounds like an incremental build issue, when adding the new file. |
@jonathanpeppers yes, i did Clean Solution and Rebuild. Now after you tell about incremental build issue i deleted bin and obj folders and worked like a charm |
…asses Fixes: dotnet/maui#2246 Fixes: dotnet/maui#4262 Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1447865 `dotnet new maui-blazor` crashes in Release mode with: Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) It turns out that `Java.IO.InputStream.GetReadHandler()` was linked away. So we need to preserve: <linker> <assembly fullname="Mono.Android"> <type fullname="Android.Runtime.InputStreamAdapter" preserve="methods" /> <type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" /> Long-term, we should consider reworking `mono.android.jar`, so that the linker *knows* about any C# methods called from Java from this library. This regresses apk size a reasonable amount: --"PackageSize": 2680724 ++"PackageSize": 2697108 Adding ~16kb. I considered adding: <type fullname="Android.Runtime.XmlResourceParserReader" /> <type fullname="Android.Runtime.XmlPullParserReader" /> <type fullname="Android.Runtime.XmlReaderResourceParser" /> <type fullname="Android.Runtime.XmlReaderPullParser" /> But this regressed app size by too much! 1,141,062 Package size difference 42.57% (of 2,680,724)
…asses Fixes: dotnet/maui#2246 Fixes: dotnet/maui#4262 Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1447865 Revert "[One .NET] Do not preserve IO stream adapter/invoker (dotnet#5449)" This reverts commit 051cad7. `dotnet new maui-blazor` crashes in Release mode with: Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) It turns out that `Java.IO.InputStream.GetReadHandler()` was linked away. So we need to preserve: <linker> <assembly fullname="Mono.Android"> <type fullname="Android.Runtime.InputStreamAdapter" preserve="methods" /> <type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" /> Long-term, we should consider reworking `mono.android.jar`, so that the linker *knows* about any C# methods called from Java from this library. This regresses apk size a reasonable amount: --"PackageSize": 2680724 ++"PackageSize": 2697108 Adding ~16kb. I considered adding: <type fullname="Android.Runtime.XmlResourceParserReader" /> <type fullname="Android.Runtime.XmlPullParserReader" /> <type fullname="Android.Runtime.XmlReaderResourceParser" /> <type fullname="Android.Runtime.XmlReaderPullParser" /> But this regressed app size by too much! 1,141,062 Package size difference 42.57% (of 2,680,724)
…asses (#6675) Fixes: dotnet/maui#2246 Fixes: dotnet/maui#4262 Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1447865 Context: b7a368a Revert "[One .NET] Do not preserve IO stream adapter/invoker (#5449)" This reverts commit 051cad7. If you run the `maui-blazor` template in a Release build: dotnet build -t:Run -c Release it crashes at runtime: Android.Runtime.JavaProxyThrowable: Exception_WasThrown, Android.Runtime.JavaProxyThrowable --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) --- End of managed Android.Runtime.JavaProxyThrowable stack trace --- android.runtime.JavaProxyThrowable: System.ArgumentException: Arg_DlgtTargMeth at System.Delegate.CreateDelegate(Type , Type , String , Boolean , Boolean ) at System.Delegate.CreateDelegate(Type , Type , String ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , String ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue* ) at Android.Runtime.JNIEnv.CallStaticObjectMethod(IntPtr , IntPtr , JValue[] ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Runtime.InputStreamAdapter..ctor(Stream ) at Android.Runtime.InputStreamAdapter.ToLocalJniHandle(Stream ) at Android.Webkit.WebResourceResponse..ctor(String , String , Int32 , String , IDictionary`2 , Stream ) at Microsoft.AspNetCore.Components.WebView.Maui.WebKitWebViewClient.ShouldInterceptRequest(WebView view, IWebResourceRequest request) at Android.Webkit.WebViewClient.n_ShouldInterceptRequest_Landroid_webkit_WebView_Landroid_webkit_WebResourceRequest_(IntPtr , IntPtr , IntPtr , IntPtr ) at crc64d693e2d9159537db.WebKitWebViewClient.n_shouldInterceptRequest(Native Method) at crc64d693e2d9159537db.WebKitWebViewClient.shouldInterceptRequest(WebKitWebViewClient.java:39) at Rr.a(chromium-TrichromeWebViewGoogle.apk-stable-410410686:16) at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.apk-stable-410410686:2) It turns out that `Java.IO.InputStream.GetReadHandler()` was linked away. So we need to preserve: <linker> <assembly fullname="Mono.Android"> <type fullname="Android.Runtime.InputStreamAdapter" preserve="methods" /> <type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" /> Long-term, we should consider reworking `mono.android.jar`, so that the linker *knows* about any C# methods called from Java from this library, or *drop* `mono.android.jar` & `mono.android.dex` and treat `Mono.Android.dll` as a "normal user assembly"… This regresses `.apk` size by ~16KB: --"PackageSize": 2680724 ++"PackageSize": 2697108 I considered adding: <type fullname="Android.Runtime.XmlResourceParserReader" /> <type fullname="Android.Runtime.XmlPullParserReader" /> <type fullname="Android.Runtime.XmlReaderResourceParser" /> <type fullname="Android.Runtime.XmlReaderPullParser" /> But this regressed app size by too much! 1,141,062 Package size difference 42.57% (of 2,680,724)
For MAUI-Blazor project, I tried all the mentioned methods (clean, rebuild) but the application started to crash again. |
@aokocax I think there's a mistake in your file https://github.com/aokocax/MauiBlazorLinker/blob/master/MauiBlazorLinker/ILLink.Descriptors.xml. Its contents don't look like what was suggested by @SilverioMiranda above. |
Description
I'm trying to run the base maui-blazor template in Visual Studio 2022 Preview 3 in release mode. In android devices the application crashes as soon as the .net intro screen passes. (It works perfectly in debug mode)
Steps to Reproduce
Create a new Maui-Blazor App
Run on release mode
Expected Behavior
No crash.
Actual Behavior
The application crashes as soon as the .net intro screen passes.
Basic Information
Version with issue: .net 6 preview 7
Last known good version: -
IDE: Visual Studio 2022 Preview 3
Platform Target Frameworks: Android
Android Support Library Version: 28
Nuget Packages:
Affected Devices:
Device Log
Time Device Name Type PID Tag Message
08-25 10:01:27.911 Samsung SM-G9550 Info 3402 art Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.companyname.MauiApp11-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.MauiApp11-1/lib/x86, /data/app/com.companyname.MauiApp11-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onCreate(android.os.Bundle) (MauiAppCompatActivity.java:-2)
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.onCreate(android.os.Bundle) (MauiAppCompatActivity.java:46)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6692)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2621)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2729)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1480)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
at void android.os.Looper.loop() (Looper.java:154)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6198)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:891)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:781)
Time Device Name Type PID Tag Message
08-25 10:01:27.911 Samsung SM-G9550 Info 3402 art Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onCreate(android.os.Bundle) (MauiAppCompatActivity.java:-2)
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.onCreate(android.os.Bundle) (MauiAppCompatActivity.java:46)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6692)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2621)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2729)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1480)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
at void android.os.Looper.loop() (Looper.java:154)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6198)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:891)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:781)
The text was updated successfully, but these errors were encountered: