Closed JaneySprings closed 10 months ago
Does this have a CI build I can try? I’m interested in the easy-to-get speedscope files. 😀
Hi, @jonathanpeppers! I had attached zip file (build for Windows-x64 and Mac-arm64) (my azure license doesn't allow public access 😒 ) DotNet.Meteor.v4.0.0.zip
or you can build vsix from this pr.
dotnet tool restore
dotnet cake --target=vsix --arch=osx-arm64 (dotnet runtime identifier of your PC)
This is still an pre-pre-pre-alpha-0.0.0.01 version, work is in progress, I have not added gcdump
yet, only dotnet-trace
. Also, the trace does not work on the physical iPhone yet. I want to try using mlaunch --tcp-tunnel
instead of --forward-ios
from the documentation.
You can install this via vscode -> command palette -> type vsix
. After that, open your .NET project and create the .vscode/launch.json
file with the following content:
{
"version": "0.2.0",
"configurations": [
// For Debugging
{
"name": ".NET Meteor Debugger",
"type": "dotnet-meteor.debugger",
"request": "launch",
"preLaunchTask": "dotnet-meteor: Build"
},
// For Profiling
{
"name": ".NET Meteor Profiler",
"type": "dotnet-meteor.debugger",
"request": "launch",
"profilerMode": "trace",
"preLaunchTask": "dotnet-meteor: Build"
}
]
}
Done! Select this configuration in the debug menu and run your app (you need to run the application without debugging, vscode top menu -> run -> run without debugging
)
When the application starts, you will see a message about the launch of dotnet-trace
in the debug console. In the folder .meteor/YOU_APP.bin
file will be created (maybe I need to rename this file into .nettrace...?)
To complete the trace, stop debugging in VSCode (if you just close the application on the device, the trace may be damaged)
After completion, you will see the message:
Stopping the trace. This may take several minutes depending on the application being traced.
Trace completed.
A 'speedscope.json' file will be created In the .meteor
folder
Enjoy!
Thank you, @jonathanpeppers, for your help with profiler! Without it, I would still be trying to run the log:heapshot,calls....
and get a mldp
report 🥹
Hi, @jonathanpeppers ! Now you can officially try the new .NET Meteor extension version (4.0.1). Сheck the readme to find out how to enable the profiler. https://marketplace.visualstudio.com/items?itemName=nromanov.dotnet-meteor
Thank you!
- gcdump (does not work. Ask MS, implement in future minor)
Let me know if there's something that I can help with. I wrote mono-gcdump for .NET 7, have experience with the .NET 8 native support, and I maintain a cross-platform viewer at https://github.com/1hub/dotnet-heapview.
Hi, @filipnavara ! Yep, I have seen these projects, Thanks!
Of course, I want to make dotnet-gcdump
work, since .NET Meteor already has a dependency on the dotnet diagnostics
repository. But at the moment, if I follow the official wiki, I just get the message Waiting for...
from gcdump
and the application also hangs waiting for the profiler.
I will try to see what can be done, but if nothing works out, then of course I will return to your projects 😉. Anyway, I'll use your heap viewer (I've already put a star ⭐️)
the official wiki
Got a link? There's actually more than one wiki page with the instructions. If there's something wrong with them I can try to reproduce and correct it.
I tried to use this guide https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/tracing.md
Here's a minimal set of steps to get the GC dump, tested on my machine.
Prerequisites:
Steps:
dotnet new maui
adb shell setprop debug.mono.profile 10.0.2.2:9000,nosuspend,connect
(start as non-suspended, GC dump cannot be taken in suspended state)dotnet-dsrouter android-emu
, note down the process id in “info: dotnet-dsrouter-88526[0]”dotnet build -t:Run -f net8.0-android -p:AndroidEnableProfiler=true
(AndroidEnableProfiler
enables the diagnostic component, otherwise a no-op one is linked instead)dotnet-gcdump collect -p 88526
Thanks! I think it will work. I'll try it after the new year.
Have you tried the same approach for iOS and Maccatalyst? It seems to me that it should work too, you just need to experiment with the dsrouter
options.
In the Macios repository doesn't say anything about gcdump
, but it seems to me that the libmono-component-*
libraries are the same.
https://github.com/xamarin/xamarin-macios/wiki/Profiling
Have you tried the same approach for iOS and Maccatalyst?
Yep. The diagnostic component is included by default in Debug builds IIRC, so you don't need extra build parameter for that. The rest of the steps is basically identical, just adjust the dsrouter options accordingly.
In the Macios repository doesn't say anything about gcdump, but it seems to me that the libmono-component-* libraries are the same.
That wiki page predates the .NET 8 dotnet-gcdump support.
Hi, @filipnavara ! I have tested the way that you described above, it works as expected. You are the 'God of magic commands' 😄 Thank you!
P.S. The only thing I noticed is that your Heapview
tool doesn't start if net7.0 is not installed. I found Microsoft's <RollForward>major</RollForward>
option in the DotNet.Diagnostics repository. If it is set, dotnet
will search for the TargetFramework
version and higher. But in any case, I can pass it on when launching the tool (--roll-forward
).
The only thing I noticed is that your
Heapview
tool doesn't start if net7.0 is not installed. I found Microsoft's<RollForward>major</RollForward>
option in the DotNet.Diagnostics repository.
My goal was to update the tool to .NET 8 but there's an issue with SkiaSharp in the WebAssembly online version (emsdk version mismatch for the compiled code). I'll update the global tool to add the roll-forward policy. Thanks for bringing it to my attention!
I was able to support gcdump
on Android
(Emulator/Device), iOS
(Emulator/Device) and Windows
. For some reason, it is not possible to establish a connection on Maccatalyst
.
-p:Profiling=true
optionDOTNET_DiagnosticPorts=127.0.0.1:9000,nosuspend,listen ./Content/MacOS/MauiApp
command run gcdump with the dotnet gcdump collect --diagnostic-port 127.0.0.1:9000,connect
command and get the error: System.Net.Sockets.SocketException (49): Can't assign requested address
@filipnavara, have you come across something like this, or is it better to create an issue in the xamarin-macios repository?
have you come across something like this, or is it better to create an issue in the xamarin-macios repository?
Incidentally, someone filed an issue for this yesterday - https://github.com/dotnet/runtime/issues/96970. I plan to look into it at some point.
Yep, trace
broken on MacOS after last update. My app jumps endlessly in the dock =)
I remember exactly how it worked.