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

[BUG] Unable to build, deploy or debug non MAUI iOS apps #1684

Open
CartBlanche opened this issue Dec 12, 2024 · 5 comments
Open

[BUG] Unable to build, deploy or debug non MAUI iOS apps #1684

CartBlanche opened this issue Dec 12, 2024 · 5 comments
Labels
area-hotreload Issues with Hot Reload experiences area-maui bug Something isn't working

Comments

@CartBlanche
Copy link

Describe the Issue

VSCode seems to be an unable to build, deploy or debug non MAUI iOS apps. To clarify it is standard iOS, .NET app.
With the default MAUI launch it insists on firing off the AOT build, which seems to be part of HotReload feature and throws an error like this:

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8316/targets/Xamarin.Shared.Sdk.targets(1266,3): error : Failed to AOT compile Microsoft.Maui.Controls.HotReload.Forms.dll, the AOT compiler exited with code 139. [/Users/xxx/{PathToiOSProject}.csproj]

If I add <EnableHotReload>false</EnableHotReload> to the csproj file it builds and deploys to the iOS simulatator, but the resultant app, fails to startup. It crashes on start-up. So something is corrupt with that build.

In comparision if I load exactly the same csproj and associated sln in Visual Studio of Mac, it builds, deploys and allows me to debug, without issues.

If I then create my own launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug iOS",
            "type": "coreclr",
            "request": "launch",
            "program": "dotnet",
            "args": [
                "build",
                "-t:Run",
            ],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
        }
    ]
}

This then builds, deploys and runs on the simulator, but I'm unable to debug anything due to a debug connection issue of:

xcrun simctl launch --console --terminate-running-process 4B8D098F-5D9B-4786-82AF-DF1B6BE3527A com.companyname.MyApp
  com.companyname.MyApp: 2558
  2024-12-10 17:13:55.448981+0000 MyApp.iOS[2558:32384] Microsoft.iOS: Socket error while connecting to IDE on 127.0.0.1:10000: Connection refused
  2024-12-10 17:13:55.802768+0000 MyApp.iOS[2558:32401] [General] Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric
  2024-12-10 17:13:55.950190+0000 MyApp.iOS[2558:32316] Unbalanced calls to begin/end appearance transitions for <Microsoft_Xna_Framework_iOSGameViewController: 0x1142147b0>.
The program '[2344] dotnet' has exited with code 0 (0x0).

I also tested the above by removing ALL other extensions and keeping just the MAUI one installed (with it's dependencies) and I still get the AOT/HotReload error. So it's definitely MAUI extension related.

If MS wants everyone to move away from Visual Studio for Mac, then this stuff needs to work as easily as it does in VS for Mac.
It has to Just Work(TM)!

Steps To Reproduce

Create a non MAUI iOS app.
Try to build, deploy and debug it.

Expected Behavior

It should build, deploy and debug, without issue, like it does in Visual Studio for Mac.

Environment Information

VS Code version: Code 1.95.3 (Universal) (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Darwin arm64 24.1.0
Modes:

System Info
Item Value
CPUs Apple M2 (8 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 5, 5, 5
Memory (System) 24.00GB (0.12GB free)
Process Argv --crash-reporter-id 54a0ba00-1f93-442c-900c-686eac2545c0
Screen Reader no
VM 0%
Extensions (26)
Extension Author (truncated) Version
vscode-github-actions git 0.27.0
google-home-extension Goo 1.5.1
cortex-debug mar 1.12.1
debug-tracker-vscode mcu 0.0.15
memory-view mcu 0.0.25
peripheral-viewer mcu 1.4.6
rtos-views mcu 0.0.7
csdevkit ms- 1.14.14
csharp ms- 2.55.29
dotnet-maui ms- 1.5.34
vscode-dotnet-runtime ms- 2.2.3
vscodeintellicode-csharp ms- 2.2.3
cmake-tools ms- 1.19.52
cpptools-extension-pack ms- 1.3.0
mono-debug ms- 0.16.3
powershell ms- 2024.4.0
java red 1.37.0
LiveServer rit 5.7.9
intellicode-api-usage-examples Vis 0.2.9
vscodeintellicode Vis 1.3.2
vscode-gradle vsc 3.16.4
vscode-java-debug vsc 0.58.1
vscode-java-dependency vsc 0.24.1
vscode-java-pack vsc 0.29.0
vscode-java-test vsc 0.43.0
vscode-maven vsc 0.44.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551cf:31179979
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530

@CartBlanche CartBlanche added the bug Something isn't working label Dec 12, 2024
@emaf emaf added the needs-more-info Needing more information, waiting on OP label Dec 12, 2024
@emaf
Copy link
Member

emaf commented Dec 12, 2024

@BretJohnson for the build issue when Hot Reload is enabled.

@CartBlanche could you remove the launch.json, change the MAUI Debug Verbosity from the VS Code settings to Diagnostic, and then build again with Hot Reload disabled and share the binlog file that's going to be generated in your solution folder?

@emaf emaf added the area-maui label Dec 12, 2024
@CartBlanche
Copy link
Author

I'll give that a try later today.

Copy link

@emaf, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

@github-actions github-actions bot removed the needs-more-info Needing more information, waiting on OP label Dec 20, 2024
@CartBlanche
Copy link
Author

@emaf & @BretJohnson So it seems the key was setting Hot Reload to Disabled in the actual main extension settings and then build, deploy, debug all worked 🎆 . I then re-enabled it and set the csproj tag as false:
<HotReloadEnabled>false</HotReloadEnabled>
This then threw the AOT build error I mentioned earlier.
So I'm not able to turn off Hot Reload on a per project basis, it seems.

As the 1st scenario allows me to progress, I won't give you that binlog. But here is the binlog for the project level HotReloadEnabled = false scenario - https://gist.github.com/CartBlanche/929fc43ded18d57347d990e93b97ab3f

I had to gist it, as github won't let me upload it here.

As I work with both MAUI and non MAUI projects, it would be good if both options worked.

@emaf emaf added the area-hotreload Issues with Hot Reload experiences label Dec 20, 2024
@emaf
Copy link
Member

emaf commented Dec 20, 2024

@BretJohnson this seems to be a Hot Reload related issue, could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-hotreload Issues with Hot Reload experiences area-maui bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants