[dotnet-trace/dsrouter] simplify mobile tracing to a one-liner!#5542
Closed
jonathanpeppers wants to merge 2 commits intodotnet:mainfrom
Closed
[dotnet-trace/dsrouter] simplify mobile tracing to a one-liner!#5542jonathanpeppers wants to merge 2 commits intodotnet:mainfrom
jonathanpeppers wants to merge 2 commits intodotnet:mainfrom
Conversation
Context: dotnet/android#10351 Context: dotnet/macios#23429 We are adding new MSBuild properties to simplify setting `$DOTNET_DiagnosticPorts` on mobile: * `$(DiagnosticAddress)` * `$(DiagnosticPort)` * `$(DiagnosticSuspend)` * `$(DiagnosticListenMode)` * `$(DiagnosticConfiguration)` if you want to specify the full value yourself, escape `,` with `%2c`, etc. We will ship these properties in future releases of .NET 9 and 10. To improve `dsrouter` the current log message: Start an application on android device with ONE of the following environment variables set: [Default Tracing] DOTNET_DiagnosticPorts=127.0.0.1:9000,nosuspend,connect [Startup Tracing] DOTNET_DiagnosticPorts=127.0.0.1:9000,suspend,connect Will change to: Build and run an Android application such as: [Default Tracing] dotnet build -t:Run -c Release -p:DiagnosticAddress=127.0.0.1 -p:DiagnosticPort=9000 -p:DiagnosticSuspend=false -p:DiagnosticListenMode=connect [Startup Tracing] dotnet build -t:Run -c Release -p:DiagnosticAddress=127.0.0.1 -p:DiagnosticPort=9000 -p:DiagnosticSuspend=true -p:DiagnosticListenMode=connect Note that `dotnet run` *does work*, but it doesn't show good progress on the build & deploy steps as compared to `dotnet build -t:Run` and MSBuild's terminal logger. It can take several seconds to run a `Release` build. I think it's better to recommend `-t:Run` until we improve `dotnet run`.
This is WIP, I have a TODO list at the bottom.
This enables you to do:
dotnet-trace collect --dsrouter android -- dotnet build MyApp.csproj -t:Run -c Release -p:DiagnosticSuspend=false
Where `-p:DiagnosticSuspend=false` is optional.
What this does:
* `dotnet-trace` starts
* `dotnet-trace` launches `dotnet-dsrouter` passing the `--` unmatched
args along.
* `dotnet-dsrouter` appends additional MSBuild properties if it
detects the unmatched args are a `dotnet build` or `dotnet run`
commands
* `dotnet-dsrouter` launches the command for the unmatched args.
~~ TODO ~~
- [ ] Merge this one first: dotnet#5535
- [ ] Figure out how we show progress. `dotnet build -t:Run` can take
30 seconds+, so it seems like we somehow need to let the terminal
logger show progress? Not sure how that can work.
- [ ] Switches after the `--` must be quoted in some cases: `'-t:Run'`
for example. This is also a problem with plain `dotnet-trace`. This
could maybe be addressed in a separate PR.
Member
Author
|
Will revisit this in the future. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is WIP, I have a TODO list at the bottom.
This enables you to do:
Where
-p:DiagnosticSuspend=falseis optional.What this does:
dotnet-tracestartsdotnet-tracelaunchesdotnet-dsrouterpassing the--unmatchedargs along.
dotnet-dsrouterappends additional MSBuild properties if itdetects the unmatched args are a
dotnet buildordotnet runcommands
dotnet-dsrouterlaunches the command for the unmatched args.TODO
Merge this one first: [dsrouter] improved instructions/log messages #5535
Figure out how we show progress.
dotnet build -t:Runcan take30 seconds+, so it seems like we somehow need to let the terminal
logger show progress? Not sure how that can work.
Switches after the
--must be quoted in some cases:'-t:Run'for example. This is also a problem with plain
dotnet-trace. Thiscould maybe be addressed in a separate PR.
For iOS, we may want to pass
-p:_MlaunchWaitForExit=falsesothat it doesn't block on console output. That would mean we might
also want the MSBuild property to be public.