xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.47k stars 514 forks source link

[Tracing]: Command `127.0.0.1:<port>,suspend,listen` is broken for the release build #21530

Closed JaneySprings closed 1 week ago

JaneySprings commented 1 week ago

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

dotnet 8.0.403

Description

Hi! I'm a creator of .NET Meteor extension for VSCode. It has a profiler feature for .NET apps. I have an issue with profiling in the release configuration. It seems like it was broken recently. Profiling (dotnet-trace) works perfectly for the Debug build.

Application isn't hangs and doesn't wait for the profiler in Release build (even if -p:MtouchProfiling=true specified). It seems like libmono-component-diagnostics_tracing-static.a library doesn't include in the app bundle.

Steps to Reproduce

  1. Build with dotnet build app.csproj -p:Configuration=Release -p:TargetFramework=net8.0-ios -p:RuntimeIdentifier=ios-arm64 -p:MtouchProfiling=true
  2. Run dsrouter with --forward-port iOS
  3. Install app with mlaunch
  4. Run app with mlaunch and pass env --setenv=DOTNET_DiagnosticPorts=127.0.0.1:9000,suspend,listen

Did you find any workaround?

no

Build logs

msbuild.binlog.zip

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk.net8.0_18.0/18.0.8303/tools/bin/mlaunch

WARNING: dotnet-dsrouter is a development tool not intended for production environments.

info: dotnet-dsrouter-21044[0] Starting dotnet-dsrouter using pid=21044 info: dotnet-dsrouter-21044[0] Starting IPC server (/Users/nromanov/ios-port.lock) <--> TCP client (127.0.0.1:9000) router. info: dotnet-dsrouter-21044[0] Successfully connected new device, id=1.

2024-10-25 23:19:31.338 mlaunch[21045:189563] Requested but did not find extension point with identifier Xcode.IDEDebugger.VariablesViewQuickLookProvider for extension Xcode.SpriteKit.GKStateMachineQuickLookProvider of plug-in com.apple.IDESpriteKitParticleEditor ... Installing application bundle 'com.companyname.rmaui' on 'MyIPhoneX' Application bundle 'com.companyname.rmaui' installed on 'MyIPhoneX' 2024-10-25 23:19:39.143 mlaunch[21050:189654] Requested but did not find extension point with identifier Xcode.IDEPlaygroundsKit.PlaygroundBottomBarExecutionAdaptor for extension Xcode.IDEPlaygroundEditor.IDEPlaygroundBottomBarExecutionAdaptor of plug-in com.apple.dt.IDEPlaygroundEditorPlugin ... Launched application 'com.companyname.rmaui' on 'MyIPhoneX' with pid 60985 2024-10-25 23:19:40.279 RadioMaui[60985:17008407] You've implemented -[ application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.

rolfbjarne commented 1 week ago

I don't think this has ever worked in .NET, for Release mode you need to set MtouchDebug=true in order to make profiling work.

We have an issue to make MtouchProfiling (or a similar property name) work, but it hasn't been implemented yet: https://github.com/xamarin/xamarin-macios/issues/19370

rolfbjarne commented 1 week ago

Closing as duplicate of #19370.

JaneySprings commented 1 week ago

Yeah, MtouchDebug=true instead of MtouchProfiling=true works. Thank you, @rolfbjarne !