dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

Black screen on iOS #10314

Closed paulvarache closed 2 years ago

paulvarache commented 2 years ago

Description

iOS app in debug mode starts in the simulator, shows the splash screen, then only a black screen.

After my most recent VS update, the version of dotnet in my terminal is 7.0.100-rc.1.22431.12

Steps to Reproduce

  1. Create a new Maui App project (Choose dotnet 6.0, long term support)
  2. Build for iOS

Link to public reproduction project repository

https://github.com/paulvarache/MauiIOSUpdateIssue

Version with bug

Unknown/Other (please specify)

Last version that worked well

6.0.424

Affected platforms

iOS

Affected platform versions

iOS 15.4 Visual Studio 17.4.0 Preview 2.1

Did you find any workaround?

Choosing 7.0 in the project creation menu dos make the app work

Relevant log output

No response

jfversluis commented 2 years ago

@rolfbjarne @dalexsoto does this mean something to you?

rolfbjarne commented 2 years ago

This is probably a duplicate of https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1621047.

@paulvarache can you try adding this to your project file and see if that helps?

<PropertyGroup>
    <TrimmerDefaultAction>copy</TrimmerDefaultAction>
</PropertyGroup>
ghost commented 2 years ago

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

paulvarache commented 2 years ago

Thanks for that. I have tried on the linked blank project, and it seems to work.

Unfortunately, when I try on the bigger project I am working on, it does not solve the issue.

I rolled back my VS to 17.4.0 preview 1 and the issue was still there. Same with 17.3.4 stable, so I assume it has to do with the workload installation (I have read somewhere these might not be tied to a VS installation). But I don't know enough about all this to be 100% sure.

Any other idea of a potential workaround?

rolfbjarne commented 2 years ago

@paulvarache does your bigger project work in VS for Mac?

ewerspej commented 2 years ago

I experience the same problem when debugging on iOS Simulators, the screen is black after the splash screen. The red notification bar at the bottom of VS says "XAML Hot Reload initializing" for a long time and then the screen eventually turns black (sometimes, the splash screen just stays instead).

Setup MAUI App Project initialized with .NET 6.0 (using a previous VS Preview) Visual Studio 17.4. Preview 2.1 iOS Simulator running iPhone 12 Pro with iOS 15.5

Installed .NET SDKs (using dotnet --list-sdks): 3.1.423 [C:\Program Files\dotnet\sdk] 6.0.400 [C:\Program Files\dotnet\sdk] 6.0.401 [C:\Program Files\dotnet\sdk] 7.0.100-rc.1.22431.12 [C:\Program Files\dotnet\sdk]

Installed .NET Runtimes (using dotnet --list-runtimes): Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.0-rc.1.22427.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.0-rc.1.22426.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.0-rc.1.22427.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Console Output 2022-09-27 11:45:48.500909+0200 VisualCountDown[4115:48731] Options: 2022-09-27 11:45:48.501293+0200 VisualCountDown[4115:48731] --bool-flag (Example) type: bool default: false 2022-09-27 11:45:48.501607+0200 VisualCountDown[4115:48731] --aot-lazy-assembly-load (Load assemblies referenced by AOT images lazily) type: bool default: false Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/Microsoft.iOS.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Runtime.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Collections.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Runtime.InteropServices.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Threading.Thread.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Threading.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/VisualCountDown.dll Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/Microsoft.Maui.dll [External] Resolved pending breakpoint for 'VisualCountDown.Program.Main(System.String[])' to C:\Users\ewers\source\repos\VisualCountDown\VisualCountDown\Platforms\iOS\Program.cs:10 [0x00000]. Loaded assembly: data-0x7fc903294000 [External] Loaded assembly: data-0x7fc903289000 [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/netstandard.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Linq.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Collections.Concurrent.dll [External] Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:423 [0x00000]. Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Text.Json.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.Text.Encodings.Web.dll [External] Loaded assembly: /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/System.ComponentModel.dll [External] 2022-09-27 11:45:52.502215+0200 VisualCountDown[4115:48731] warning: Could not load signature of Microsoft.Maui.Controls.HotReload.Forms.MauiHelpers:get_CurrentApplication due to: Could not resolve type with token 010000bd from typeref (expected class 'Microsoft.Maui.IApplication' in assembly 'Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:Microsoft.Maui.IApplication member:(null)

================================================================= Native Crash Reporting

Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

================================================================= Native stacktrace:

0x10f0f6b75 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x10f09681e - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x10efeceb3 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_sigsegv_signal_handler_debug
0x7fff701bddfd - /usr/lib/system/libsystem_platform.dylib : _sigtramp
0x0 - Unknown
0x10f117a99 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : generate_code
0x10f12a98e - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : generate
0x10f12a397 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_interp_transform_method
0x10f108b34 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : do_transform_method
0x10f0fa710 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : interp_exec_method
0x10f0f80ff - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : interp_runtime_invoke
0x10efefd3b - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
0x10ef13dcf - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_runtime_try_invoke
0x10dd08b9e - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmono-component-debugger.dylib : mono_do_invoke_method
0x10dd1401c - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmono-component-debugger.dylib : suspend_current
0x10dd07c83 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmono-component-debugger.dylib : process_event
0x10dd07464 - /Users/ewers/Lib

rary/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmono-component-debugger.dylib : mono_dbg_process_breakpoint_events 0x10dd1de70 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmono-component-debugger.dylib : mono_de_process_breakpoint 0x10dd1283d - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmono-component-debugger.dylib : debugger_agent_breakpoint_from_context 0x10d38f39c - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/VisualCountDown : sdb_breakpoint_trampoline 0x10f107755 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : do_debugger_tramp 0x10f104c13 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : interp_exec_method 0x10f0f80ff - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : interp_runtime_invoke 0x10efefd3b - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_jit_runtime_invoke 0x10ef12328 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_runtime_invoke_checked 0x10ef190cb - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_runtime_exec_main_checked 0x10f0521e2 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libmonosgen-2.0.dylib : mono_jit_exec 0x10deb3e9d - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/libxamarin-dotnet-debug.dylib : xamarin_main 0x10d448954 - /Users/ewers/Library/Developer/CoreSimulator/Devices/218D84F1-5FBA-43D9-8C28-B30548ECF059/data/Containers/Bundle/Application/A18C53DA-9D40-4F9A-91EB-C99B91D92143/VisualCountDown.app/VisualCountDown : main 0x10da94f21 - Unknown 0x118dcd52e - Unknown

================================================================= Basic Fault Address Reporting

Memory around native instruction pointer (0x10f130d06):0x10f130cf6 00 49 2b 46 78 48 c1 e8 03 44 69 c8 ab aa aa aa .I+F xH...Di.....

0x10f130d06 41 0f b7 4d 08 41 8b 45 0c c1 e8 16 83 e0 01 01 A..M.A.E........ 0x10f130d16 c8 44 39 c8 7e 34 49 8b 0e 49 8b 56 28 48 8b 71 .D9.~4I ..I.V(H.q 0x10f130d26 08 4c 8b 41 18 48 8b 4e 40 49 2b 56 20 48 89 54 .L .A.H.N@I+V H.T

================================================================= Managed Stacktrace:

  at <unknown> <0xffffffff>
  at <unknown> <0xffffffff>
  at <InitAgents>d__36:MoveNext <0x0039e>
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore:Start <0x0008c>
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00010>
  at Xamarin.HotReload.HotReloadAgent:InitAgents <0x00062>
  at Xamarin.HotReload.HotReloadAgent:.ctor <0x0018e>
  at Xamarin.HotReload.HotReloadAgent:GetInstance <0x00036>
  at <Module>:runtime_invoke_direct_HotReloadAgent_uint_bool_string_bool <0x000e8>
  at <unknown> <0x00000>
  at <unknown> <0xffffffff>
  at VisualCountDown.Program:Main <0x00004>
  at <Module>:runtime_invoke_direct_void_string[] <0x00076>
  at <unknown> <0x00000>

=================================================================

ewerspej commented 2 years ago

changing the TargetFramework for iOS to net7.0-ios temporarily solves the issue, the following line was added to the .csproj file by VS when changing the TargetFramework:

<TargetFrameworks>net6.0-maccatalyst;net7.0-ios;net7.0-android</TargetFrameworks>

PureWeen commented 2 years ago

This will be resolved with the next release of VS

paulvarache commented 1 year ago

Hi,

I can confirm that on a new project this doesn't happen anymore. Unfortunately we are still having this issue on our existing project, even after updating VS.

I removed all extra dependencies and deleted most of the code, but I still get a black screen after the splash screen on iOS. This is tested on VS for mac preview 17.4 build 2326. Here is a link to the stripped down version of our app: https://github.com/paulvarache/MauiBlackScreenIOS

Given new projects work, and this bare bones version of our project doesn't, I suspect there might be some cached files somewhere on the system as I deleted obj and bin folder before every test.

Some help would be really appreciated as this is blocking us entirely from going live with our app on iOS and we have no workaround.

ghost commented 1 year ago

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!

paulvarache commented 1 year ago

The black screen issue in our app was related to something else, although the symptoms were the exact same as this issue. If anyone stumble upon something similar, double check the values in your Info.plist, in my case an Info.plist that worked with a previous MAUI version caused this issue and had to be updated