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

Maui-Blazor iPhone gives memory error #4037

Closed
aokocax opened this issue Jan 11, 2022 · 8 comments
Closed

Maui-Blazor iPhone gives memory error #4037

aokocax opened this issue Jan 11, 2022 · 8 comments
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects

Comments

@aokocax
Copy link

aokocax commented Jan 11, 2022

Description

I can run the default MAUI app on my iPhone (as local device), but MAUI-Blazor gives this error.
[0:] An error occurred: 'Objective-C exception thrown. Name: NSInvalidArgumentException Reason: *** NSAllocateMemoryPages(4425286896) failed

When I remove the BlazorWebView (MainPage.xaml), the problem goes away.

I tried two different device
iPhone 7 Plus iOS version 15.3
iPhone 13 Pro Max iOS version 15.1 ( It doesn't give same error but it stucks)

Steps to Reproduce

  1. Create default MAUI-Blazor project
  2. Debug on iPhone (Local device)
  3. It crashes

Version with bug

Preview 11

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.1, iOS 15.3

Did you find any workaround?

No response

Relevant log output

[0:] An error occurred: 'Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: *** NSAllocateMemoryPages(4425286896) failed
Native stack trace:
	0   CoreFoundation                      0x0000000182966d50 1C534967-D61F-3EC8-95AF-3C82B9FFA981 + 597328
	1   libobjc.A.dylib                     0x000000019a2606a8 objc_exception_throw + 56
	2   Foundation                          0x000000018409054c NSAllocateMemoryPages + 192
	3   Foundation                          0x000000018403ed80 0E1EE1F4-972B-34E8-BC91-82CBC4A45543 + 163200
	4   Foundation                          0x0000000184051d94 0E1EE1F4-972B-34E8-BC91-82CBC4A45543 + 241044
	5   Xamarin.PreBuilt.iOS                0x0000000103377b2c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2424548
	6   Xamarin.PreBuilt.iOS                0x0000000103376d34 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2420972
	7   Xamarin.PreBuilt.iOS                0x000000010336c53c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2377972
	8   Xamarin.PreBuilt.iOS                0x000000010336aa3c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2371060
	9   Xamarin.PreBuilt.iOS                0x0000000103333dbc _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2146676
	10  Xamarin.PreBuilt.iOS                0x000000010326d050 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1332232
	11  Xamarin.PreBuilt.iOS                0x0000000103270c80 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1347640
	12  Xamarin.PreBuilt.iOS                0x000000010301e9f8 _Z9__isctypeim + 30144
	13  Xamarin.PreBuilt.iOS                0x0000000103025984 xamarin_get_original_working_directory_path + 4120
	14  Xamarin.PreBuilt.iOS                0x00000001030264f8 _ZN16XamarinCallState3selEv + 2868
	15  WebKit                              0x0000000190ccc0d0 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 3440848
	16  WebKit                              0x0000000190db15d0 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 4380112
	17  WebKit                              0x0000000190d73274 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 4125300
	18  WebKit                              0x0000000190d731dc 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 4125148
	19  WebKit                              0x000000019109ab38 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 7433016
	20  WebKit                              0x00000001909d77c0 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 341952
	21  WebKit                              0x0000000190dabc48 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 4357192
	22  WebKit                              0x00000001909b6e98 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 208536
	23  WebKit                              0x00000001909b65c8 48A0600D-46E4-3E2B-B218-53E80FEC2D1E + 206280
	24  JavaScriptCore                      0x000000018e41ab08 6D906824-54B4-3799-B613-3B7E24836C3B + 16579336
	25  JavaScriptCore                      0x000000018e41b9ec 6D906824-54B4-3799-B613-3B7E24836C3B + 16583148
	26  CoreFoundation                      0x00000001829872b0 1C534967-D61F-3EC8-95AF-3C82B9FFA981 + 729776
	27  CoreFoundation                      0x00000001829972d8 1C534967-D61F-3EC8-95AF-3C82B9FFA981 + 795352
	28  CoreFoundation                      0x00000001828da678 1C534967-D61F-3EC8-95AF-3C82B9FFA981 + 22136
	29  CoreFoundation                      0x00000001828dfaa8 1C534967-D61F-3EC8-95AF-3C82B9FFA981 + 43688
	30  CoreFoundation                      0x00000001828f2e1c CFRunLoopRunSpecific + 572
	31  GraphicsServices                    0x00000001a32cc9a0 GSEventRunModal + 160
	32  UIKitCore                           0x00000001851285ec F0C259A7-7B03-3E89-9A72-B82DD45A84F9 + 5162476
	33  UIKitCore                           0x0000000184ebdaf4 UIApplicationMain + 2028
	34  Xamarin.PreBuilt.iOS                0x0000000103377b2c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2424548
	35  Xamarin.PreBuilt.iOS                0x0000000103376d34 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2420972
	36  Xamarin.PreBuilt.iOS                0x000000010336c53c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2377972
	37  Xamarin.PreBuilt.iOS                0x000000010336aa3c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2371060
	38  Xamarin.PreBuilt.iOS                0x0000000103333dbc _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2146676
	39  Xamarin.PreBuilt.iOS                0x000000010326d050 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1332232
	40  Xamarin.PreBuilt.iOS                0x0000000103275328 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1365728
	41  Xamarin.PreBuilt.iOS                0x000000010322f318 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1078992
	42  Xamarin.PreBuilt.iOS                0x000000010323aac4 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1126012
	43  Xamarin.PreBuilt.iOS                0x0000000103377b2c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2424548
	44  Xamarin.PreBuilt.iOS                0x0000000103376d34 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2420972
	45  Xamarin.PreBuilt.iOS                0x000000010336c53c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2377972
	46  Xamarin.PreBuilt.iOS                0x000000010336aa3c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2371060
	47  Xamarin.PreBuilt.iOS                0x0000000103333dbc _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2146676
	48  Xamarin.PreBuilt.iOS                0x000000010326d050 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1332232
	49  Xamarin.PreBuilt.iOS                0x0000000103273b28 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 1359584
	50  Xamarin.PreBuilt.iOS                0x0000000103339ae0 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2170520
	51  Xamarin.PreBuilt.iOS                0x00000001030257c4 xamarin_get_original_working_directory_path + 3672
	52  Xamarin.PreBuilt.iOS                0x00000001033b2160 _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode + 2663704
	53  dyld                                0x00000001037b0250 start + 444
'. Callstack: '   at ObjCRuntime.Runtime.ThrowNSException(IntPtr ns_exception)
   at ObjCRuntime.Runtime.throw_ns_exception(IntPtr exc)
   at Foundation.NSData.FromBytes(IntPtr bytes, nuint size)
   at Foundation.NSData.FromArray(Byte[] buffer)
   at Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.SchemeHandler.StartUrlSchemeTask(WKWebView webView, IWKUrlSchemeTask urlSchemeTask)
--- End of stack trace from previous location ---
   at Foundation.NSData.FromBytes(IntPtr bytes, nuint size)
   at Foundation.NSData.FromArray(Byte[] buffer)
   at Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.SchemeHandler.StartUrlSchemeTask(WKWebView webView, IWKUrlSchemeTask urlSchemeTask)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at MauiAppBlazorp11.Program.Main(String[] args) in C:\Users\MKA-M\source\repos\MauiAppBlazorp11\MauiAppBlazorp11\Platforms\iOS\Program.cs:line 13
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)'
The app has been terminated.
@aokocax aokocax added the t/bug Something isn't working label Jan 11, 2022
@jsuarezruiz jsuarezruiz added this to New in Triage via automation Jan 11, 2022
@jsuarezruiz jsuarezruiz added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Jan 11, 2022
@AntonKosenkoDX
Copy link

Also run into this issue

@RaspeR87
Copy link

Same for me. If I want to run ".NET MAUI App (Preview) template" everything works ok.
But if I run ".NET MAUI Blazor App (Preview) template" I got same error.

@aokocax
Copy link
Author

aokocax commented Jan 18, 2022

If I connect the iphone via MAC and run it over the remote device, it does not give an error.

@RaspeR87
Copy link

RaspeR87 commented Jan 19, 2022

@aokocax Yes, I tested it now and it works from Windows via MAC (both templates). (y)

@SteveSandersonMS
Copy link
Member

According to #4061 (comment), it's now working to develop against a local iPhone. Can you please confirm if it's still not working on the latest preview for you?

If it's working we'll close this.

@SteveSandersonMS SteveSandersonMS added the s/needs-info Issue needs more info from the author label Feb 23, 2022
@ghost
Copy link

ghost commented Feb 23, 2022

Hi @aokocax. 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.

@mkArtakMSFT mkArtakMSFT added this to the .NET 7 milestone Feb 23, 2022
@aokocax
Copy link
Author

aokocax commented Feb 24, 2022

According to #4061 (comment), it's now working to develop against a local iPhone. Can you please confirm if it's still not working on the latest preview for you?

If it's working we'll close this.

Hi, Unfortunately I can't. I have updated Visual Studio and MAUI but It doesn't show ios or android devices. I've been trying to fix it for two hours.
image

image

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Feb 24, 2022
@aokocax
Copy link
Author

aokocax commented Feb 26, 2022

After a few minor adjustments, I was able to run the project. #4932

The news is good, it worked smoothly. Thanks, I'm closing the issue.

@aokocax aokocax closed this as completed Feb 26, 2022
Triage automation moved this from New to Done Feb 26, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/iOS 🍎 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

7 participants