Skip to content

Various misc fixes and cleanup - #5421

Merged
mikem8361 merged 10 commits into
dotnet:mainfrom
mikem8361:misc_cleanup2
Apr 17, 2025
Merged

mikem8361 merged 10 commits into
dotnet:mainfrom
mikem8361:misc_cleanup2

Conversation

@mikem8361

Copy link
Copy Markdown
Contributor

This PR is broken down into individual commits for:

  • Use IHost temp directory in symbol service. Solves problems in containers with R/O tmp directories.
  • Remove ISymbolService.GetMetaData() and replace with IModuleService.CreateModule call. Move/rename ManagedImageMappingModuleService into ImageMappingMemoryService class.
  • Add detailed help for finalizequeue and various other managed command. the help for sos commands isn't up to date #5235
  • Workaround bug in ParseResult.Empty() called by HelpContext constructor. System.CommandLine was throwing an exception because there was no application name under lldb.
  • Add hosting runtime information in sosstatus command. Fix issue in sethostruntime command. Don't print 0.0 for the runtime version. Help diagnose host runtime problems in the future.
  • Display full exception if collect --diag and use sync command line APIs. Help diagnose exceptions collecting a dump on Windows to diagnose issue Failed to collect dump using dotnet-dump --type Heap #5312.
  • Workaround issue in .NET 8.0 DAC causing test failures on Alpine. Not worth fixing the 8.0 DAC but causing repeated test failures on Alpine.
  • Properly clear/release g_sos15/g_sos16 globals.
  • Bump 8.0/9.0 test versions to latest.

@mikem8361
mikem8361 requested review from hoyosjs and noahfalk April 10, 2025 19:50
@mikem8361 mikem8361 self-assigned this Apr 10, 2025
@mikem8361
mikem8361 requested a review from a team as a code owner April 10, 2025 19:50
noahfalk
noahfalk previously approved these changes Apr 16, 2025

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions inline where I think we've got opportunity to simplify

@mikem8361
mikem8361 requested review from a team and Copilot April 16, 2025 15:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR applies several miscellaneous fixes and cleanup improvements across extension commands and core services, addressing issues from help documentation to module creation and symbol processing. Key changes include the addition of detailed help text for various commands, removal of obsolete APIs and services, and improved handling for temporary directories and module validations.

Reviewed Changes

Copilot reviewed 53 out of 54 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Microsoft.Diagnostics.ExtensionCommands/EEHeapCommand.cs Added detailed help text for the eeheap command.
src/Microsoft.Diagnostics.ExtensionCommands/DumpStackObjectsCommand.cs Added detailed help text for the dumpstackobjects command.
src/Microsoft.Diagnostics.ExtensionCommands/DumpRuntimeTypeCommand.cs Added detailed help text for runtime type dumping and clarified output information.
src/Microsoft.Diagnostics.ExtensionCommands/DumpHeapCommand.cs Extended detailed help text with examples and discussion of GC heap fragmentation.
src/Microsoft.Diagnostics.ExtensionCommands/DumpGenCommand.cs Updated help examples for the dumpgen command.
src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentQueueCommand.cs Enhanced help text for the dump concurrent queue command.
src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs Enhanced help text for the dump concurrent dictionary command.
src/Microsoft.Diagnostics.ExtensionCommands/AnalyzeOOMCommand.cs Added detailed help text for analyzing managed OOM scenarios.
src/Microsoft.Diagnostics.DebugServices/ISymbolService.cs Removed the obsolete GetMetadata method.
src/Microsoft.Diagnostics.DebugServices/IModuleService.cs Updated CreateModule signature with improved documentation and parameter validation.
src/Microsoft.Diagnostics.DebugServices.Implementation/Utilities.cs Added an extension method for creating modules from ClrModule instances.
src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs Updated symbol file downloading to use the host-specific temporary directory.
src/Microsoft.Diagnostics.DebugServices.Implementation/ModuleService.cs Added checks in CreateModule to throw on invalid module parameters.
src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs Updated GetMetadata to use new syntax for returning an empty array.
src/Microsoft.Diagnostics.DebugServices.Implementation/MetadataMappingMemoryService.cs Revised metadata retrieval to utilize the new IModuleService.CreateModule call.
src/Microsoft.Diagnostics.DebugServices.Implementation/ManagedImageMappingModuleService.cs Removed the ManagedImageMappingModuleService in favour of a new approach.
src/Microsoft.Diagnostics.DebugServices.Implementation/ImageMappingMemoryService.cs Changed module service initialization and enhanced temporary directory handling.
src/Microsoft.Diagnostics.DebugServices.Implementation/Host.cs Improved temporary directory path determination based on host OS.
src/Microsoft.Diagnostics.DebugServices.Implementation/CommandService.cs Improved help context construction and replaced placeholder prompts with host-specific ones.
Files not reviewed (1)
  • eng/Versions.props: Language not supported
Comments suppressed due to low confidence (2)

src/Microsoft.Diagnostics.ExtensionCommands/DumpHeapCommand.cs:171

  • Replace "it's" with "its" to correctly use the possessive form.
Dumpheap is a powerful command that traverses the garbage collected heap, collection statistics about objects. With it's various options, it can look for

src/Microsoft.Diagnostics.DebugServices.Implementation/Module.cs:210

  • Ensure that the new empty array literal syntax returns an ImmutableArray as expected; consider reverting to ImmutableArray.Empty if compatibility issues arise.
return [];

Comment thread src/Tools/dotnet-dump/Dumper.cs Resolved
tommcdon
tommcdon previously approved these changes Apr 17, 2025

@tommcdon tommcdon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple comments for your consideration otherwise LGTM!

@mikem8361
mikem8361 dismissed stale reviews from tommcdon and noahfalk via 7e8b505 April 17, 2025 15:56
@mikem8361
mikem8361 enabled auto-merge (squash) April 17, 2025 15:56
@mikem8361
mikem8361 merged commit 83ec576 into dotnet:main Apr 17, 2025
@mikem8361
mikem8361 deleted the misc_cleanup2 branch April 21, 2025 16:39
noahfalk added a commit that referenced this pull request May 21, 2025
## Problem 

In the past SOS.OtherCommands test was failing on Alpine Linux with
error:

```
System.Exception : VerifyOutput: no last command output or debugger exited unexpectedly: \s*Name:\s+SymbolTestApp.Program\s+
```

We believe the issue was resolved in
#5421 but the tests had never
been re-enabled. This PR re-enables the test.

Fixes #4654.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: noahfalk <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants