diff --git a/README.md b/README.md index 28b4412e51..08d8d367ed 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ To install the platform's prerequisites and build: * [FAQ](documentation/FAQ.md) - Frequently asked questions. * [The LLDB Debugger](http://lldb.llvm.org/index.html) - More information about lldb. * [SOS](https://msdn.microsoft.com/en-us/library/bb190764(v=vs.110).aspx) - More information about SOS. -* [Debugging CoreCLR](https://github.com/dotnet/runtime/blob/main/docs/workflow/debugging/coreclr/debugging.md) - Instructions for debugging .NET Core and the CoreCLR runtime. +* [Debugging CoreCLR](https://github.com/dotnet/runtime/blob/main/docs/workflow/debugging/coreclr/debugging-runtime.md) - Instructions for debugging .NET Core and the CoreCLR runtime. * [dotnet/runtime](https://github.com/dotnet/runtime) - Source for the .NET Core runtime. * [Official Build Instructions](documentation/building/official-build-instructions.md) - Internal official build instructions. diff --git a/documentation/design-docs/ipc-protocol.md b/documentation/design-docs/ipc-protocol.md index 42c28f7b30..24fb0e5ec3 100644 --- a/documentation/design-docs/ipc-protocol.md +++ b/documentation/design-docs/ipc-protocol.md @@ -950,7 +950,7 @@ Example usage: $ export DOTNET_DiagnosticPorts=$DOTNET_DiagnosticPorts;~/mydiagport.sock,nosuspend; ``` -Any diagnostic ports specified in this configuration will be created in addition to the default port (`dotnet-diagnostic--`). The suspend mode of the default port is set via the new environment variable `DOTNET_DefaultDotnetPortSuspend` which defaults to `0` for `nosuspend`. +Any diagnostic ports specified in this configuration will be created in addition to the default port (`dotnet-diagnostic--`). The suspend mode of the default port is set via the new environment variable `DOTNET_DefaultDiagnosticPortSuspend` which defaults to `0` for `nosuspend`. Each port configuration specifies whether it is a `suspend` or `nosuspend` port. Ports specifying `suspend` in their configuration will cause the runtime to pause early on in the startup path before most runtime subsystems have started. This allows any agent to receive a connection and properly setup before the application startup continues. Since multiple ports can individually request suspension, the `resume` command needs to be sent by each suspended port connection before the runtime resumes execution. diff --git a/documentation/sos-debugging-extension-windows.md b/documentation/sos-debugging-extension-windows.md deleted file mode 100644 index 6fc8785afd..0000000000 --- a/documentation/sos-debugging-extension-windows.md +++ /dev/null @@ -1,249 +0,0 @@ ---- -title: "SOS Debugging Extension" -ms.date: "10/3/2018" -helpviewer_keywords: - - "debugging extensions" - - "SOS debugging extensions" - - "xplat debugging" -ms.assetid: TBD -author: "mikem" -ms.author: "mikem" ---- -# SOS debugging extension for Windows - -## Syntax - -```shell -![command] [options] -``` -### Command Summary - -SOS is a debugger extension DLL designed to aid in the debugging of managed programs. Functions are listed by category, then roughly in order of importance. Shortcut names for popular functions are listed in parenthesis. -Type `!help ` for detailed info on that function. - - Object Inspection Examining code and stacks - ----------------------------- ----------------------------- - DumpObj (do, dumpobj) Threads (clrthreads) - DumpArray (da) ThreadState - DumpAsync IP2MD - DumpStackObjects (dso) U - DumpHeap DumpStack - DumpVC EEStack - GCRoot CLRStack - ObjSize GCInfo - FinalizeQueue EHInfo - PrintException (pe) BPMD - TraverseHeap COMState - - Examining CLR data structures Diagnostic Utilities - ----------------------------- ----------------------------- - DumpDomain VerifyHeap - EEHeap VerifyObj - Name2EE FindRoots - SyncBlk HeapStat - DumpMT GCWhere - DumpClass ListNearObj (lno) - DumpMD GCHandles - Token2EE GCHandleLeaks - EEVersion FinalizeQueue (fq) - DumpModule FindAppDomain - ThreadPool SaveModule - DumpAssembly ProcInfo - DumpSigElem StopOnException (soe) - DumpRuntimeTypes DumpLog - DumpSig VMMap - RCWCleanupList VMStat - DumpIL MinidumpMode - DumpRCW AnalyzeOOM (ao) - DumpCCW - - Examining the GC history Other - ----------------------------- ----------------------------- - HistInit SetHostRuntime (sethostruntime) - HistRoot SetSymbolServer (setsymbolserver) - HistObj FAQ - HistObjFind SOSFlush - HistClear SOSStatus (sosstatus) - FAQ - Help (soshelp) - -## Commands - -|Command|Description| -|-------------|-----------------| -|**AnalyzeOOM** (**ao**)|Displays the information for the last out of memory (OOM) that occurred on an allocation request to the garbage collection heap. (In server garbage collection, it displays OOM, if any, on each garbage collection heap.)| -|**BPMD** (**bpmd**) [**-nofuturemodule**] [\<*module name*> \<*method name*>] [**-md** <`MethodDesc`>] **-list** **-clear** \<*pending breakpoint number*> **-clearall**|Creates a breakpoint at the specified method in the specified module.

If the specified module and method have not been loaded, this command waits for a notification that the module was loaded and just-in-time (JIT) compiled before creating a breakpoint.

You can manage the list of pending breakpoints by using the **-list**, **-clear**, and **-clearall** options:

The **-list** option generates a list of all the pending breakpoints. If a pending breakpoint has a non-zero module ID, that breakpoint is specific to a function in that particular loaded module. If the pending breakpoint has a zero module ID, that breakpoint applies to modules that have not yet been loaded.

Use the **-clear** or **-clearall** option to remove pending breakpoints from the list.| -|**CLRStack** [**-a**] [**-l**] [**-p**] [**-n**] [**-f**] [**-r**] [**-all**]|Provides a stack trace of managed code only.

The **-p** option shows arguments to the managed function.

The **-l** option shows information on local variables in a frame. The SOS Debugging Extension cannot retrieve local names, so the output for local names is in the format \<*local address*> **=** \<*value*>.

The **-a** option is a shortcut for **-l** and **-p** combined.

The **-n** option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS will look up the symbols for every managed frame and if successful will display the corresponding source file name and line number. The **-n** (No line numbers) parameter can be specified to disable this behavior.

The **-f** option (full mode) displays the native frames intermixing them with the managed frames and the assembly name and function offset for the managed frames.

The **-r** option dumps the registers for each stack frame.

The **-all** option dumps all the managed threads' stacks.| -|**COMState**|Lists the COM apartment model for each thread and a `Context` pointer, if available.| -|**DumpArray** [**-start** \<*startIndex*>] [**-length** \<*length*>] [**-details**] [**-nofields**] \<*array object address*>

-or-

**DA** [**-start** \<*startIndex*>] [**-length** \<*length*>] [**-detail**] [**-nofields**] *array object address*>|Examines elements of an array object.

The **-start** option specifies the starting index at which to display elements.

The **-length** option specifies how many elements to show.

The **-details** option displays details of the element using the **DumpObj** and **DumpVC** formats.

The **-nofields** option prevents arrays from displaying. This option is available only when the **-detail** option is specified.| -|**DumpAssembly** \<*assembly address*>|Displays information about an assembly.

The **DumpAssembly** command lists multiple modules, if they exist.

You can get an assembly address by using the **DumpDomain** command.| -|**DumpClass** \<*EEClass address*>|Displays information about the `EEClass` structure associated with a type.

The **DumpClass** command displays static field values but does not display nonstatic field values.

Use the **DumpMT**, **DumpObj**, **Name2EE**, or **Token2EE** command to get an `EEClass` structure address.| -|**DumpDomain** [\<*domain address*>]|Enumerates each object that is loaded within the specified object address. When called with no parameters, the **DumpDomain** command lists all objects in a process.| -|**DumpHeap** [**-stat**] [**-strings**] [**-short**] [**-min** \<*size*>] [**-max** \<*size*>] [**-thinlock**] [**-startAtLowerBound**] [**-mt** \<*MethodTable address*>] [**-type** \<*partial type name*>][*start* [*end*]]|Displays information about the garbage-collected heap and collection statistics about objects.

The **DumpHeap** command displays a warning if it detects excessive fragmentation in the garbage collector heap.

The **-stat** option restricts the output to the statistical type summary.

The **-strings** option restricts the output to a statistical string value summary.

The **-short** option limits output to just the address of each object. This lets you easily pipe output from the command to another debugger command for automation.

The **-min** option ignores objects that are less than the `size` parameter, specified in bytes.

The **-max** option ignores objects that are larger than the `size` parameter, specified in bytes.

The **-thinlock** option reports ThinLocks. For more information, see the **SyncBlk** command.

The `-startAtLowerBound` option forces the heap walk to begin at the lower bound of a supplied address range. During the planning phase, the heap is often not walkable because objects are being moved. This option forces **DumpHeap** to begin its walk at the specified lower bound. You must supply the address of a valid object as the lower bound for this option to work. You can display memory at the address of a bad object to manually find the next method table. If the garbage collection is currently in a call to `memcopy`, you may also be able to find the address of the next object by adding the size to the start address, which is supplied as a parameter.

The **-mt** option lists only those objects that correspond to the specified `MethodTable` structure.

The **-type** option lists only those objects whose type name is a substring match of the specified string.

The `start` parameter begins listing from the specified address.

The `end` parameter stops listing at the specified address.| -|**DumpIL** \<*Managed DynamicMethod object*> | \<*DynamicMethodDesc pointer*> | \<*MethodDesc pointer*>|Displays the Microsoft intermediate language (MSIL) that is associated with a managed method.

Note that dynamic MSIL is emitted differently than MSIL that is loaded from an assembly. Dynamic MSIL refers to objects in a managed object array rather than to metadata tokens.| -|**DumpLog** [**-addr** \<*addressOfStressLog*>] [<*Filename*>]|Writes the contents of an in-memory stress log to the specified file. If you do not specify a name, this command creates a file called StressLog.txt in the current directory.

The in-memory stress log helps you diagnose stress failures without using locks or I/O. To enable the stress log, set the following registry keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\\.NETFramework:

(DWORD) StressLog = 1

(DWORD) LogFacility = 0xffffffff

(DWORD) StressLogSize = 65536

The optional `-addr` option lets you specify a stress log other than the default log.| -|**DumpMD** \<*MethodDesc address*>|Displays information about a `MethodDesc` structure at the specified address.

You can use the **IP2MD** command to get the `MethodDesc` structure address from a managed function.| -|**DumpMT** [**-MD**] \<*MethodTable address*>|Displays information about a method table at the specified address. Specifying the **-MD** option displays a list of all methods defined with the object.

Each managed object contains a method table pointer.| -|**DumpModule** [**-mt**] \<*Module address*>|Displays information about a module at the specified address. The **-mt** option displays the types defined in a module and the types referenced by the module

You can use the **DumpDomain** or **DumpAssembly** command to retrieve a module's address.| -|**DumpObj** [**-nofields**] \<*object address*>

-or-

**DO** \<*object address*>|Displays information about an object at the specified address. The **DumpObj** command displays the fields, the `EEClass` structure information, the method table, and the size of the object.

You can use the **DumpStackObjects** command to retrieve an object's address.

Note that you can run the **DumpObj** command on fields of type `CLASS` because they are also objects.

The `-`**nofields** option prevents fields of the object being displayed, it is useful for objects like String.| -|**DumpRuntimeTypes**|Displays the runtime type objects in the garbage collector heap and lists their associated type names and method tables.| -|**DumpStack** [**-EE**] [**-n**] [`top` *stack* [`bottom` *stac*`k`]]|Displays a stack trace.

The **-EE** option causes the **DumpStack** command to display only managed functions. Use the `top` and `bottom` parameters to limit the stack frames displayed on x86 platforms.

The **-n** option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS will look up the symbols for every managed frame and if successful will display the corresponding source file name and line number. The **-n** (No line numbers) parameter can be specified to disable this behavior.

On x86 and x64 platforms, the **DumpStack** command creates a verbose stack trace.

On IA-64-based platforms, the **DumpStack** command mimics the debugger's **K** command. The `top` and `bottom` parameters are ignored on IA-64-based platforms.| -|**DumpSig** \<*sigaddr*> \<*moduleaddr*>|Displays information about a `Sig` structure at the specified address.| -|**DumpSigElem** \<*sigaddr*> \<*moduleaddr*>|Displays a single element of a signature object. In most cases, you should use **DumpSig** to look at individual signature objects. However, if a signature has been corrupted in some way, you can use **DumpSigElem** to read the valid portions of it.| -|**DumpStackObjects** [**-verify**] [`top` *stack* [`bottom` *stack*]]

-or-

**DSO** [**-verify**] [`top` *stack* [`bottom` *stack*]]|Displays all managed objects found within the bounds of the current stack.

The **-verify** option validates each non-static `CLASS` field of an object field.

Use the **DumpStackObject** command with stack tracing commands such as the **K** command and the **CLRStack** command to determine the values of local variables and parameters.| -|**DumpVC** \<*MethodTable address*> \<*Address*>|Displays information about the fields of a value class at the specified address.

The **MethodTable** parameter allows the **DumpVC** command to correctly interpret fields. Value classes do not have a method table as their first field.| -|**EEHeap** [**-gc**] [**-loader**]|Displays information about process memory consumed by internal runtime data structures.

The **-gc** and **-loader** options limit the output of this command to garbage collector or loader data structures.

The information for the garbage collector lists the ranges of each segment in the managed heap. If the pointer falls within a segment range given by **-gc**, the pointer is an object pointer.| -|**EEStack** [**-short**] [**-EE**]|Runs the **DumpStack** command on all threads in the process.

The **-EE** option is passed directly to the **DumpStack** command. The **-short** parameter limits the output to the following kinds of threads:

Threads that have taken a lock.

Threads that have been stalled in order to allow a garbage collection.

Threads that are currently in managed code.| -|**EEVersion**|Displays the runtime version.| -|**EHInfo** [\<*MethodDesc address*>] [\<*Code address*>]|Displays the exception handling blocks in a specified method. This command displays the code addresses and offsets for the clause block (the `try` block) and the handler block (the `catch` block).| -|**FAQ**|Displays frequently asked questions.| -|**FinalizeQueue** [**-detail**] | [**-allReady**] [**-short**]|Displays all objects registered for finalization.

The **-detail** option displays extra information about any `SyncBlocks` that need to be cleaned up, and any `RuntimeCallableWrappers` (RCWs) that await cleanup. Both of these data structures are cached and cleaned up by the finalizer thread when it runs.

The `-allReady` option displays all objects that are ready for finalization, regardless of whether they are already marked by the garbage collection as such, or will be marked by the next garbage collection. The objects that are in the "ready for finalization" list are finalizable objects that are no longer rooted. This option can be very expensive, because it verifies whether all the objects in the finalizable queues are still rooted.

The `-short` option limits the output to the address of each object. If it is used in conjunction with **-allReady**, it enumerates all objects that have a finalizer that are no longer rooted. If it is used independently, it lists all objects in the finalizable and "ready for finalization" queues.| -|**FindAppDomain** \<*Object address*>|Determines the application domain of an object at the specified address.| -|**FindRoots** **-gen** \<*N*> | **-gen any** |\<*object address*>|Causes the debugger to break in the debuggee on the next collection of the specified generation. The effect is reset as soon as the break occurs. To break on the next collection, you have to reissue the command. The *\* form of this command is used after the break caused by the **-gen** or **-gen any** has occurred. At that time, the debuggee is in the right state for **FindRoots** to identify roots for objects from the current condemned generations.| -|**GCHandles** [**-perdomain**]|Displays statistics about garbage collector handles in the process.

The **-perdomain** option arranges the statistics by application domain.

Use the **GCHandles** command to find memory leaks caused by garbage collector handle leaks. For example, a memory leak occurs when code retains a large array because a strong garbage collector handle still points to it, and the handle is discarded without freeing it.| -|**GCHandleLeaks**|Searches memory for any references to strong and pinned garbage collector handles in the process and displays the results. If a handle is found, the **GCHandleLeaks** command displays the address of the reference. If a handle is not found in memory, this command displays a notification.| -|**GCInfo** \<*MethodDesc address*>\<*Code address*>|Displays data that indicates when registers or stack locations contain managed objects. If a garbage collection occurs, the collector must know the locations of references to objects so it can update them with new object pointer values.| -|**GCRoot** [**-nostacks**] [**-all**] \<*Object address*>|Displays information about references (or roots) to an object at the specified address.

The **GCRoot** command examines the entire managed heap and the handle table for handles within other objects and handles on the stack. Each stack is then searched for pointers to objects, and the finalizer queue is also searched.

This command does not determine whether a stack root is valid or is discarded. Use the **CLRStack** and **U** commands to disassemble the frame that the local or argument value belongs to in order to determine if the stack root is still in use.

The **-nostacks** option restricts the search to garbage collector handles and reachable objects.

The **-all** option forces all roots to be displayed instead of just the unique roots.| -|**GCWhere** *\*|Displays the location and size in the garbage collection heap of the argument passed in. When the argument lies in the managed heap but is not a valid object address, the size is displayed as 0 (zero).| -|**Help** (**soshelp**) [\<*command*>] [`faq`]|Displays all available commands when no parameter is specified, or displays detailed help information about the specified command.

The `faq` parameter displays answers to frequently asked questions.| -|**HeapStat** [**-inclUnrooted** | **-iu**]|Displays the generation sizes for each heap and the total free space in each generation on each heap. If the -**inclUnrooted** option is specified, the report includes information about the managed objects from the garbage collection heap that is no longer rooted.| -|**HistClear**|Releases any resources used by the family of `Hist` commands.

Generally, you do not have to explicitly call `HistClear`, because each `HistInit` cleans up the previous resources.| -|**HistInit**|Initializes the SOS structures from the stress log saved in the debuggee.| -|**HistObj** **|Examines all stress log relocation records and displays the chain of garbage collection relocations that may have led to the address passed in as an argument.| -|**HistObjFind** **|Displays all the log entries that reference an object at the specified address.| -|**HistRoot** *\*|Displays information related to both promotions and relocations of the specified root.

The root value can be used to track the movement of an object through the garbage collections.| -|**IP2MD** \<*Code address*>|Displays the `MethodDesc` structure at the specified address in code that has been JIT-compiled.| -|**ListNearObj** (**lno**) **|Displays the objects preceding and following the specified address. The command looks for the address in the garbage collection heap that looks like a valid beginning of a managed object (based on a valid method table) and the object following the argument address.| -|**MinidumpMode** [**0**] [**1**]|Prevents running unsafe commands when using a minidump.

Pass **0** to disable this feature or **1** to enable this feature. By default, the **MinidumpMode** value is set to **0**.

Minidumps created with the **.dump /m** command or **.dump** command have limited CLR-specific data and allow you to run only a subset of SOS commands correctly. Some commands may fail with unexpected errors because required areas of memory are not mapped or are only partially mapped. This option protects you from running unsafe commands against minidumps.| -|**Name2EE** \<*module name*> \<*type or method name*>

-or-

**Name2EE** \<*module name*>**!**\<*type or method name*>|Displays the `MethodTable` structure and `EEClass` structure for the specified type or method in the specified module.

The specified module must be loaded in the process.

To get the proper type name, browse the module by using the [Ildasm.exe (IL Disassembler)](../../../docs/framework/tools/ildasm-exe-il-disassembler.md). You can also pass `*` as the module name parameter to search all loaded managed modules. The *module name* parameter can also be the debugger's name for a module, such as `mscorlib` or `image00400000`.

This command supports the Windows debugger syntax of <`module`>`!`<`type`>. The type must be fully qualified.| -|**ObjSize** [\<*Object address*>] | [**-aggregate**] [**-stat**]|Displays the size of the specified object. If you do not specify any parameters, the **ObjSize** command displays the size of all objects found on managed threads, displays all garbage collector handles in the process, and totals the size of any objects pointed to by those handles. The **ObjSize** command includes the size of all child objects in addition to the parent.

The **-aggregate** option can be used in conjunction with the **-stat** argument to get a detailed view of the types that are still rooted. By using **!dumpheap -stat** and **!objsize -aggregate -stat**, you can determine which objects are no longer rooted and diagnose various memory issues.| -|**PrintException** [**-nested**] [**-lines**] [\<*Exception object address*>]

-or-

**PE** [**-nested**] [\<*Exception object address*>]|Displays and formats fields of any object derived from the class at the specified address. If you do not specify an address, the **PrintException** command displays the last exception thrown on the current thread.

The **-nested** option displays details about nested exception objects.

The **-lines** option displays source information, if available.

You can use this command to format and view the `_stackTrace` field, which is a binary array.| -|**ProcInfo** [**-env**] [**-time**] [**-mem**]|Displays environment variables for the process, kernel CPU time, and memory usage statistics.| -|**RCWCleanupList** \<*RCWCleanupList address*>|Displays the list of runtime callable wrappers at the specified address that are awaiting cleanup.| -|**SaveModule** \<*Base address*> \<*Filename*>|Writes an image, which is loaded in memory at the specified address, to the specified file.| -|**SOSFlush**|Flushes an internal SOS cache.| -|**SOSStatus** [**-netfx**] [**-netcore**] [**-reset**]|Display internal SOS status, reset the internal cached state, or change between the desktop .NET framework or .NET Core runtimes when both are loaded in the process or dump.

-netfx - switch to the desktop .NET Framework runtime if loaded.
-netcore - switch to the .NET Core runtime if loaded.
-reset - reset all the cached internal SOS state.

| -|**SetHostRuntime** [**-netcore**] [**-netfx**] [\]|This command controls the runtime that is used to host the maanged code that runs as part of SOS in the debugger (cdb/windbg). The default is the desktop .NET Framework. The "-netcore" option allows the installed .NET Core runtime be used. The "-netfx" option allows switches back to the .NET Framework runtime.

Normally, SOS attempts to find an installed .NET Core runtime to run its managed code automatically but this command is available if it fails. The default is to use the same runtime (libcoreclr) being debugged. Use this command if the default runtime being debugged isn't working enough to run the SOS code or if the version is less than 3.1.

If you received the following error message when running a SOS command, use this command to set the path to 3.1 or greater .NET Core runtime.

`(lldb) clrstack`
`Error: Fail to initialize CoreCLR 80004005 ClrStack failed`

`(lldb) sethostruntime /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.20`

You can use the "dotnet --info" in a command shell to find the path of an installed .NET Core runtime.| -|**StopOnException** [**-derived**] [**-create** | **-create2**] \<*Exception*> \<*Pseudo-register number*>|Causes the debugger to stop when the specified exception is thrown, but to continue running when other exceptions are thrown.

The **-derived** option catches the specified exception and every exception that derives from the specified exception.| -|**SyncBlk** [**-all** | \<*syncblk number*>]|Displays the specified `SyncBlock` structure or all `SyncBlock` structures. If you do not pass any arguments, the **SyncBlk** command displays the `SyncBlock` structure corresponding to objects that are owned by a thread.

A `SyncBlock` structure is a container for extra information that does not need to be created for every object. It can hold COM interop data, hash codes, and locking information for thread-safe operations.| -|**ThreadPool**|Displays information about the managed thread pool, including the number of work requests in the queue, the number of completion port threads, and the number of timers.| -|**Token2EE** \<*module name*> \<*token*>|Turns the specified metadata token in the specified module into a `MethodTable` structure or `MethodDesc` structure.

You can pass `*` for the module name parameter to find what that token maps to in every loaded managed module. You can also pass the debugger's name for a module, such as `mscorlib` or `image00400000`.| -|**Threads** [**-live**] [**-special**]|Displays all managed threads in the process.

The **Threads** command displays the debugger shorthand ID, the CLR thread ID, and the operating system thread ID. Additionally, the **Threads** command displays a Domain column that indicates the application domain in which a thread is executing, an APT column that displays the COM apartment mode, and an Exception column that displays the last exception thrown in the thread.

The **-live** option displays threads associated with a live thread.

The **-special** option displays all special threads created by the CLR. Special threads include garbage collection threads (in concurrent and server garbage collection), debugger helper threads, finalizer threads, unload threads, and thread pool timer threads.| -|**ThreadState \<** *State value field* **>**|Displays the state of the thread. The `value` parameter is the value of the `State` field in the **Threads** report output.| -|**TraverseHeap** [**-xml**] \<*filename*>|Writes heap information to the specified file in a format understood by the CLR profiler. The **-xml** option causes the **TraverseHeap** command to format the file as XML.

You can download the CLR Profiler from the [Microsoft Download Center](https://go.microsoft.com/fwlink/?LinkID=67325).| -|**U** [**-gcinfo**] [**-ehinfo**] [**-n**] \<*MethodDesc address*> | \<*Code address*>|Displays an annotated disassembly of a managed method specified either by a `MethodDesc` structure pointer for the method or by a code address within the method body. The **U** command displays the entire method from start to finish, with annotations that convert metadata tokens to names.

The **-gcinfo** option causes the **U** command to display the `GCInfo` structure for the method.

The **-ehinfo** option displays exception information for the method. You can also obtain this information with the **EHInfo** command.

The **-n** option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS looks up the symbols for every managed frame and, if successful, displays the corresponding source file name and line number. You can specify the **-n** option to disable this behavior.| -|**VerifyHeap**|Checks the garbage collector heap for signs of corruption and displays any errors found.

Heap corruptions can be caused by platform invoke calls that are constructed incorrectly.| -|**VerifyObj** \<*object address*>|Checks the object that is passed as an argument for signs of corruption.| -|**VMMap**|Traverses the virtual address space and displays the type of protection applied to each region.| -|**VMStat**|Provides a summary view of the virtual address space, ordered by each type of protection applied to that memory (free, reserved, committed, private, mapped, image). The TOTAL column displays the result of the AVERAGE column multiplied by the BLK COUNT column.| - -## Remarks - -The SOS Debugging Extension lets you view information about code that is running inside the CLR. For example, you can use the SOS Debugging Extension to display information about the managed heap, look for heap corruptions, display internal data types used by the runtime, and view information about all managed code running inside the runtime. - -To use the SOS Debugging Extension in Visual Studio, install the [Windows Driver Kit (WDK)](/windows-hardware/drivers/download-the-wdk). For information about the integrated debugging environment in Visual Studio, see [Debugging Environments](/windows-hardware/drivers/debugger/debuggers-in-the-debugging-tools-for-windows-package). - -You can also use the SOS Debugging Extension by loading it into the [WinDbg.exe debugger](/windows-hardware/drivers/debugger/debugger-download-tools) and executing commands within WinDbg.exe. - -To load the SOS Debugging Extension into the WinDbg.exe debugger, run the following command in the tool: - -``` -.loadby sos coreclr -``` - -WinDbg.exe and Visual Studio use a version of SOS.dll that corresponds to the version of Mscorwks.dll currently in use. By default, you should use the version of SOS.dll that matches the current version of Mscorwks.dll. - -To use a dump file created on another computer, make sure that the Mscorwks.dll file that came with that installation is in your symbol path, and load the corresponding version of SOS.dll. - -To load a specific version of SOS.dll, type the following command into the Windows Debugger: - -``` -.load -``` - -## Examples - -The following command displays the contents of an array at the address `00ad28d0`. The display starts from the second element and continues for five elements. - -``` -!dumparray -start 2 -length 5 -detail 00ad28d0 -``` - - The following command displays the contents of an assembly at the address `1ca248`. - -``` -!dumpassembly 1ca248 -``` - - The following command displays information about the garbage collector heap. - -``` -!dumpheap -``` - - The following command writes the contents of the in-memory stress log to a (default) file called StressLog.txt in the current directory. - -``` -!DumpLog -``` - - The following command displays the `MethodDesc` structure at the address `902f40`. - -``` -!dumpmd 902f40 -``` - - The following command displays information about a module at the address `1caa50`. - -``` -!dumpmodule 1caa50 -``` - - The following command displays information about an object at the address `a79d40`. - -``` -!DumpObj a79d40 -``` - - The following command displays the fields of a value class at the address `00a79d9c` using the method table at the address `0090320c`. - -``` -!DumpVC 0090320c 00a79d9c -``` - - The following command displays the process memory used by the garbage collector. - -``` -!eeheap -gc -``` - - The following command displays all objects scheduled for finalization. - -``` -!finalizequeue -``` - - The following command determines the application domain of an object at the address `00a79d98`. - -``` -!findappdomain 00a79d98 -``` - - The following command displays all garbage collector handles in the current process. - -``` -!gcinfo 5b68dbb8 -``` - - The following command displays the `MethodTable` and `EEClass` structures for the `Main` method in the class `MainClass` in the module `unittest.exe`. - -``` -!name2ee unittest.exe MainClass.Main -``` - - The following command displays information about the metadata token at the address `02000003` in the module `unittest.exe`. - -``` -!token2ee unittest.exe 02000003 -``` - diff --git a/documentation/sos-debugging-extension.md b/documentation/sos-debugging-extension.md deleted file mode 100644 index 92ebe04472..0000000000 --- a/documentation/sos-debugging-extension.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -title: "SOS Debugging Extension" -ms.date: "10/3/2018" -helpviewer_keywords: - - "debugging extensions" - - "SOS debugging extensions" - - "xplat debugging" -ms.assetid: TBD -author: "mikem" -ms.author: "mikem" ---- -# SOS debugging extension for xplat - -The SOS Debugging Extension lets you view information about code that is running inside the .NET Core runtime. For example, you can use the SOS Debugging Extension to display information about the managed heap, look for heap corruptions, display internal data types used by the runtime, and view information about all managed code running inside the runtime. - -## Syntax - -```shell -sos [command] [options] -``` - -Many of the commands have aliases or short cuts under lldb: - -``` -clrstack [options] -``` - -### Command Summary - -SOS is a lldb debugger extension designed to aid in the debugging of managed programs. Functions are listed by category, then roughly in order of -importance. Shortcut names for popular functions are listed in parenthesis. Type `soshelp ` for detailed info on that function. - - Object Inspection Examining code and stacks - ----------------------------- ----------------------------- - DumpObj (dumpobj) Threads (clrthreads) - DumpArray ThreadState - DumpAsync (dumpasync) IP2MD (ip2md) - DumpStackObjects (dso) u (clru) - DumpHeap (dumpheap) DumpStack (dumpstack) - DumpVC EEStack (eestack) - GCRoot (gcroot) CLRStack (clrstack) - ObjSize GCInfo - PrintException (pe) EHInfo - bpmd (bpmd) - - Examining CLR data structures Diagnostic Utilities - ----------------------------- ----------------------------- - DumpDomain (dumpdomain) VerifyHeap - EEHeap (eeheap) FindAppDomain - Name2EE (name2ee) GCHandles - DumpMT (dumpmt) DumpLog (dumplog) - DumpClass (dumpclass) SuppressJitOptimization - DumpMD (dumpmd) ThreadPool (threadpool) - Token2EE - DumpModule (dumpmodule) - DumpAssembly - DumpRuntimeTypes - DumpIL (dumpil) - DumpSig - DumpSigElem - - Examining the GC history Other - ----------------------------- ----------------------------- - HistInit (histinit) SetHostRuntime (sethostruntime) - HistRoot (histroot) SetSymbolServer (setsymbolserver, loadsymbols) - HistObj (histobj) SetClrPath (setclrpath) - HistObjFind (histobjfind) SOSFlush (sosflush) - HistClear (histclear) SOSStatus (sosstatus) - FAQ - Help (soshelp) - -## Commands - -|Command|Description| -|-------------|-----------------| -|**bpmd** [**-nofuturemodule**] [\<*module name*> \<*method name*>] [**-md** <`MethodDesc`>] **-list** **-clear** \<*pending breakpoint number*> **-clearall**|Creates a breakpoint at the specified method in the specified module.

If the specified module and method have not been loaded, this command waits for a notification that the module was loaded and just-in-time (JIT) compiled before creating a breakpoint.

You can manage the list of pending breakpoints by using the **-list**, **-clear**, and **-clearall** options:

The **-list** option generates a list of all the pending breakpoints. If a pending breakpoint has a non-zero module ID, that breakpoint is specific to a function in that particular loaded module. If the pending breakpoint has a zero module ID, that breakpoint applies to modules that have not yet been loaded.

Use the **-clear** or **-clearall** option to remove pending breakpoints from the list.| -|**CLRStack** [**-a**] [**-l**] [**-p**] [**-n**] [**-f**] [**-r**] [**-all**]|Provides a stack trace of managed code only.

The **-p** option shows arguments to the managed function.

The **-l** option shows information on local variables in a frame. The SOS Debugging Extension cannot retrieve local names, so the output for local names is in the format \<*local address*> **=** \<*value*>.

The **-a** option is a shortcut for **-l** and **-p** combined.

The **-n** option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS will look up the symbols for every managed frame and if successful will display the corresponding source file name and line number. The **-n** (No line numbers) parameter can be specified to disable this behavior.

The **-f** option (full mode) displays the native frames intermixing them with the managed frames and the assembly name and function offset for the managed frames.

The **-r** option dumps the registers for each stack frame.

The **-all** option dumps all the managed threads' stacks.| -|**DumpArray** [**-start** \<*startIndex*>] [**-length** \<*length*>] [**-details**] [**-nofields**] \<*array object address*>

-or-

**DA** [**-start** \<*startIndex*>] [**-length** \<*length*>] [**-detail**] [**-nofields**] *array object address*>|Examines elements of an array object.

The **-start** option specifies the starting index at which to display elements.

The **-length** option specifies how many elements to show.

The **-details** option displays details of the element using the **DumpObj** and **DumpVC** formats.

The **-nofields** option prevents arrays from displaying. This option is available only when the **-detail** option is specified.| -|**DumpAsync** (**dumpasync**) [**-mt** \<*MethodTable address*>] [**-type** \<*partial type name*>] [**-waiting**] [**-roots**]|DumpAsync traverses the garbage collected heap, looking for objects representing async state machines as created when an async method's state is transferred to the heap. This command recognizes async state machines defined as `async void`, `async Task`, `async Task`, `async ValueTask`, and `async ValueTask`.

The output includes a block of details for each async state machine object found. These details include:
- a line for the type of the async state machine object, including its MethodTable address, its object address, its size, and its type name.
- a line for the state machine type name as contained in the object.
- a listing of each field on the state machine.
- a line for a continuation from this state machine object, if one or more has been registered.
- discovered GC roots for this async state machine object.
| -|**DumpAssembly** \<*assembly address*>|Displays information about an assembly.

The **DumpAssembly** command lists multiple modules, if they exist.

You can get an assembly address by using the **DumpDomain** command.| -|**DumpClass** \<*EEClass address*>|Displays information about the `EEClass` structure associated with a type.

The **DumpClass** command displays static field values but does not display nonstatic field values.

Use the **DumpMT**, **DumpObj**, **Name2EE**, or **Token2EE** command to get an `EEClass` structure address.| -|**DumpDomain** [\<*domain address*>]|Enumerates each object that is loaded within the specified object address. When called with no parameters, the **DumpDomain** command lists all objects in a process.| -|**DumpHeap** [**-stat**] [**-strings**] [**-short**] [**-min** \<*size*>] [**-max** \<*size*>] [**-thinlock**] [**-startAtLowerBound**] [**-mt** \<*MethodTable address*>] [**-type** \<*partial type name*>][*start* [*end*]]|Displays information about the garbage-collected heap and collection statistics about objects.

The **DumpHeap** command displays a warning if it detects excessive fragmentation in the garbage collector heap.

The **-stat** option restricts the output to the statistical type summary.

The **-strings** option restricts the output to a statistical string value summary.

The **-short** option limits output to just the address of each object. This lets you easily pipe output from the command to another debugger command for automation.

The **-min** option ignores objects that are less than the `size` parameter, specified in bytes.

The **-max** option ignores objects that are larger than the `size` parameter, specified in bytes.

The **-thinlock** option reports ThinLocks. For more information, see the **SyncBlk** command.

The `-startAtLowerBound` option forces the heap walk to begin at the lower bound of a supplied address range. During the planning phase, the heap is often not walkable because objects are being moved. This option forces **DumpHeap** to begin its walk at the specified lower bound. You must supply the address of a valid object as the lower bound for this option to work. You can display memory at the address of a bad object to manually find the next method table. If the garbage collection is currently in a call to `memcopy`, you may also be able to find the address of the next object by adding the size to the start address, which is supplied as a parameter.

The **-mt** option lists only those objects that correspond to the specified `MethodTable` structure.

The **-type** option lists only those objects whose type name is a substring match of the specified string.

The `start` parameter begins listing from the specified address.

The `end` parameter stops listing at the specified address.| -|**DumpIL** \<*Managed DynamicMethod object*> | \<*DynamicMethodDesc pointer*> | \<*MethodDesc pointer*>|Displays the Microsoft intermediate language (MSIL) that is associated with a managed method.

Note that dynamic MSIL is emitted differently than MSIL that is loaded from an assembly. Dynamic MSIL refers to objects in a managed object array rather than to metadata tokens.| -|**DumpLog** [**-addr** \<*addressOfStressLog*>] [<*Filename*>]|Writes the contents of an in-memory stress log to the specified file. If you do not specify a name, this command creates a file called StressLog.txt in the current directory.

The in-memory stress log helps you diagnose stress failures without using locks or I/O. To enable the stress log, set the following registry keys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\\.NETFramework:

(DWORD) StressLog = 1

(DWORD) LogFacility = 0xffffffff

(DWORD) StressLogSize = 65536

The optional `-addr` option lets you specify a stress log other than the default log.| -|**DumpMD** \<*MethodDesc address*>|Displays information about a `MethodDesc` structure at the specified address.

You can use the **IP2MD** command to get the `MethodDesc` structure address from a managed function.| -|**DumpMT** [**-MD**] \<*MethodTable address*>|Displays information about a method table at the specified address. Specifying the **-MD** option displays a list of all methods defined with the object.

Each managed object contains a method table pointer.| -|**DumpModule** [**-mt**] \<*Module address*>|Displays information about a module at the specified address. The **-mt** option displays the types defined in a module and the types referenced by the module

You can use the **DumpDomain** or **DumpAssembly** command to retrieve a module's address.| -|**DumpObj** [**-nofields**] \<*object address*>

-or-

**DO** \<*object address*>|Displays information about an object at the specified address. The **DumpObj** command displays the fields, the `EEClass` structure information, the method table, and the size of the object.

You can use the **DumpStackObjects** command to retrieve an object's address.

Note that you can run the **DumpObj** command on fields of type `CLASS` because they are also objects.

The `-`**nofields** option prevents fields of the object being displayed, it is useful for objects like String.| -|**DumpRuntimeTypes**|Displays the runtime type objects in the garbage collector heap and lists their associated type names and method tables.| -|**DumpStack** [**-EE**] [**-n**] [`top` *stack* [`bottom` *stac*`k`]]|Displays a stack trace.

The **-EE** option causes the **DumpStack** command to display only managed functions. Use the `top` and `bottom` parameters to limit the stack frames displayed on x86 platforms.

The **-n** option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS will look up the symbols for every managed frame and if successful will display the corresponding source file name and line number. The **-n** (No line numbers) parameter can be specified to disable this behavior.

On x86 and x64 platforms, the **DumpStack** command creates a verbose stack trace.

On IA-64-based platforms, the **DumpStack** command mimics the debugger's **K** command. The `top` and `bottom` parameters are ignored on IA-64-based platforms.| -|**DumpSig** \<*sigaddr*> \<*moduleaddr*>|Displays information about a `Sig` structure at the specified address.| -|**DumpSigElem** \<*sigaddr*> \<*moduleaddr*>|Displays a single element of a signature object. In most cases, you should use **DumpSig** to look at individual signature objects. However, if a signature has been corrupted in some way, you can use **DumpSigElem** to read the valid portions of it.| -|**DumpStackObjects** [**-verify**] [`top` *stack* [`bottom` *stack*]]

-or-

**DSO** [**-verify**] [`top` *stack* [`bottom` *stack*]]|Displays all managed objects found within the bounds of the current stack.

The **-verify** option validates each non-static `CLASS` field of an object field.

Use the **DumpStackObject** command with stack tracing commands such as the **K** command and the **clrstack** command to determine the values of local variables and parameters.| -|**DumpVC** \<*MethodTable address*> \<*Address*>|Displays information about the fields of a value class at the specified address.

The **MethodTable** parameter allows the **DumpVC** command to correctly interpret fields. Value classes do not have a method table as their first field.| -|**EEHeap** [**-gc**] [**-loader**]|Displays information about process memory consumed by internal runtime data structures.

The **-gc** and **-loader** options limit the output of this command to garbage collector or loader data structures.

The information for the garbage collector lists the ranges of each segment in the managed heap. If the pointer falls within a segment range given by **-gc**, the pointer is an object pointer.| -|**EEStack** [**-short**] [**-EE**]|Runs the **DumpStack** command on all threads in the process.

The **-EE** option is passed directly to the **DumpStack** command. The **-short** parameter limits the output to the following kinds of threads:

Threads that have taken a lock.

Threads that have been stalled in order to allow a garbage collection.

Threads that are currently in managed code.| -|**EHInfo** [\<*MethodDesc address*>] [\<*Code address*>]|Displays the exception handling blocks in a specified method. This command displays the code addresses and offsets for the clause block (the `try` block) and the handler block (the `catch` block).| -|**FAQ**|Displays frequently asked questions.| -|**FindAppDomain** \<*Object address*>|Determines the application domain of an object at the specified address.| -|**GCHandles** [**-perdomain**]|Displays statistics about garbage collector handles in the process.

The **-perdomain** option arranges the statistics by application domain.

Use the **GCHandles** command to find memory leaks caused by garbage collector handle leaks. For example, a memory leak occurs when code retains a large array because a strong garbage collector handle still points to it, and the handle is discarded without freeing it.| -|**GCInfo** \<*MethodDesc address*>\<*Code address*>|Displays data that indicates when registers or stack locations contain managed objects. If a garbage collection occurs, the collector must know the locations of references to objects so it can update them with new object pointer values.| -|**GCRoot** [**-nostacks**] [**-all**] \<*Object address*>|Displays information about references (or roots) to an object at the specified address.

The **GCRoot** command examines the entire managed heap and the handle table for handles within other objects and handles on the stack. Each stack is then searched for pointers to objects, and the finalizer queue is also searched.

This command does not determine whether a stack root is valid or is discarded. Use the **clrstack** and **U** commands to disassemble the frame that the local or argument value belongs to in order to determine if the stack root is still in use.

The **-nostacks** option restricts the search to garbage collector handles and reachable objects.

The **-all** option forces all roots to be displayed instead of just the unique roots.| -|**GCWhere** *\*|Displays the location and size in the garbage collection heap of the argument passed in. When the argument lies in the managed heap but is not a valid object address, the size is displayed as 0 (zero).| -|**Help** (**soshelp**) [\<*command*>] [`faq`]|Displays all available commands when no parameter is specified, or displays detailed help information about the specified command.

The `faq` parameter displays answers to frequently asked questions.| -|**HistClear**|Releases any resources used by the family of `Hist` commands.

Generally, you do not have to explicitly call `HistClear`, because each `HistInit` cleans up the previous resources.| -|**HistInit**|Initializes the SOS structures from the stress log saved in the debuggee.| -|**HistObj** **|Examines all stress log relocation records and displays the chain of garbage collection relocations that may have led to the address passed in as an argument.| -|**HistObjFind** **|Displays all the log entries that reference an object at the specified address.| -|**HistRoot** *\*|Displays information related to both promotions and relocations of the specified root.

The root value can be used to track the movement of an object through the garbage collections.| -|**IP2MD** (**ip2md**) \<*Code address*>|Displays the `MethodDesc` structure at the specified address in code that has been JIT-compiled.| -|**Name2EE** (**name2ee**) \<*module name*> \<*type or method name*>

-or-

**Name2EE** \<*module name*>**!**\<*type or method name*>|Displays the `MethodTable` structure and `EEClass` structure for the specified type or method in the specified module.

The specified module must be loaded in the process.

To get the proper type name you can browse the module by using the an IL reflection tool like Ildasm or ILSpy. You can also pass `*` as the module name parameter to search all loaded managed modules. The *module name* parameter can also be the debugger's name for a module, such as `mscorlib` or `image00400000`.

This command supports the Windows debugger syntax of <`module`>`!`<`type`>. The type must be fully qualified.| -|**ObjSize** [\<*Object address*>] | [**-aggregate**] [**-stat**]|Displays the size of the specified object. If you do not specify any parameters, the **ObjSize** command displays the size of all objects found on managed threads, displays all garbage collector handles in the process, and totals the size of any objects pointed to by those handles. The **ObjSize** command includes the size of all child objects in addition to the parent.

The **-aggregate** option can be used in conjunction with the **-stat** argument to get a detailed view of the types that are still rooted. By using **!dumpheap -stat** and **!objsize -aggregate -stat**, you can determine which objects are no longer rooted and diagnose various memory issues.| -|**PrintException** [**-nested**] [**-lines**] [\<*Exception object address*>]

-or-

**PE** [**-nested**] [\<*Exception object address*>]|Displays and formats fields of any object derived from the class at the specified address. If you do not specify an address, the **PrintException** command displays the last exception thrown on the current thread.

The **-nested** option displays details about nested exception objects.

The **-lines** option displays source information, if available.

You can use this command to format and view the `_stackTrace` field, which is a binary array.| -|**SyncBlk** [**-all** | \<*syncblk number*>]|Displays the specified `SyncBlock` structure or all `SyncBlock` structures. If you do not pass any arguments, the **SyncBlk** command displays the `SyncBlock` structure corresponding to objects that are owned by a thread.

A `SyncBlock` structure is a container for extra information that does not need to be created for every object. It can hold COM interop data, hash codes, and locking information for thread-safe operations.| -|**SOSFlush**|Flushes an internal SOS cache.| -|**SOSStatus** [**-reset**]|Displays internal SOS status or reset the internal cached state.| -|**SetHostRuntime** [\]|This command sets the path to the .NET Core runtime to use to host the managed code that runs as part of SOS in the debugger (lldb). The runtime needs to be at least version 3.1 or greater. If there are spaces in directory, it needs to be single-quoted (').

Normally, SOS attempts to find an installed .NET Core runtime to run its managed code automatically but this command is available if it fails. The default is to use the same runtime (libcoreclr) being debugged. Use this command if the default runtime being debugged isn't working enough to run the SOS code or if the version is less than 3.1.

If you received the following error message when running a SOS command, use this command to set the path to 3.1 or greater .NET Core runtime.

`(lldb) clrstack`
`Error: Fail to initialize CoreCLR 80004005 ClrStack failed`

`(lldb) sethostruntime /usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.20`

You can use the "dotnet --info" in a command shell to find the path of an installed .NET Core runtime.| -|**SetSymbolServer** [**-ms**] [**-disable**] [**-log**] [**-loadsymbols**] [**-cache** \] [**-directory** \] [**-sympath** \] [\]|Enables the symbol server downloading support.

The **-ms** option enables downloading from the public Microsoft symbol server.

The **-disable** option turns on the symbol download support.

The **-cache** \ option specifies a symbol cache directory. The default is $HOME/.dotnet/symbolcache if not specified.

The **-directory** option add a path to search for symbols. Can be more than one.

The **-sympath** option adds server, cache and directory paths in the Windows symbol path format.

The **-log** option enables symbol download logging.

The **-loadsymbols** option attempts to download the native .NET Core symbols for the runtime.| -|**Token2EE** \<*module name*> \<*token*>|Turns the specified metadata token in the specified module into a `MethodTable` structure or `MethodDesc` structure.

You can pass `*` for the module name parameter to find what that token maps to in every loaded managed module. You can also pass the debugger's name for a module, such as `mscorlib` or `image00400000`.| -|**Threads** (**clrthreads**) [**-live**] [**-special**]|Displays all managed threads in the process.

The **Threads** command displays the debugger shorthand ID, the CLR thread ID, and the operating system thread ID. Additionally, the **Threads** command displays a Domain column that indicates the application domain in which a thread is executing, an APT column that displays the COM apartment mode, and an Exception column that displays the last exception thrown in the thread.

The **-live** option displays threads associated with a live thread.

The **-special** option displays all special threads created by the CLR. Special threads include garbage collection threads (in concurrent and server garbage collection), debugger helper threads, finalizer threads, unload threads, and thread pool timer threads.| -|**ThreadState \<** *State value field* **>**|Displays the state of the thread. The `value` parameter is the value of the `State` field in the **Threads** report output.| -|**U** [**-gcinfo**] [**-ehinfo**] [**-n**] \<*MethodDesc address*> | \<*Code address*>|Displays an annotated disassembly of a managed method specified either by a `MethodDesc` structure pointer for the method or by a code address within the method body. The **U** command displays the entire method from start to finish, with annotations that convert metadata tokens to names.

The **-gcinfo** option causes the **U** command to display the `GCInfo` structure for the method.

The **-ehinfo** option displays exception information for the method. You can also obtain this information with the **EHInfo** command.

The **-n** option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS looks up the symbols for every managed frame and, if successful, displays the corresponding source file name and line number. You can specify the **-n** option to disable this behavior.| -|**VerifyHeap**|Checks the garbage collector heap for signs of corruption and displays any errors found.

Heap corruptions can be caused by platform invoke calls that are constructed incorrectly.| - -### Aliases ### - -By default you can reach all the SOS commands by using: _sos [command\_name]_ -However the common commands have been aliased so that you don't need the SOS prefix: - - bpmd -- Creates a breakpoint at the specified managed method in the specified module. - clrstack -- Provides a stack trace of managed code only. - clrthreads -- List the managed threads running. - clru -- Displays an annotated disassembly of a managed method. - dso -- Displays all managed objects found within the bounds of the current stack. - dumpasync -- Displays info about async state machines on the garbage-collected heap. - dumpclass -- Displays information about a EE class structure at the specified address. - dumpdomain -- Displays information all the AppDomains and all assemblies within the domains. - dumpheap -- Displays info about the garbage-collected heap and collection statistics about objects. - dumpil -- Displays the Microsoft intermediate language (MSIL) that is associated with a managed method. - dumplog -- Writes the contents of an in-memory stress log to the specified file. - dumpmd -- Displays information about a MethodDesc structure at the specified address. - dumpmodule -- Displays information about a EE module structure at the specified address. - dumpmt -- Displays information about a method table at the specified address. - dumpobj -- Displays info about an object at the specified address. - dumpstack -- Displays a native and managed stack trace. - eeheap -- Displays info about process memory consumed by internal runtime data structures. - eestack -- Runs dumpstack on all threads in the process. - gcroot -- Displays info about references (or roots) to an object at the specified address. - histclear -- Releases any resources used by the family of Hist commands. - histinit -- Initializes the SOS structures from the stress log saved in the debuggee. - histobj -- Examines all stress log relocation records and displays the chain of garbage collection relocations that may have led to the address passed in as an argument. - histobjfind -- Displays all the log entries that reference an object at the specified address. - histroot -- Displays information related to both promotions and relocations of the specified root. - ip2md -- Displays the MethodDesc structure at the specified address in code that has been JIT-compiled. - loadsymbols -- Load the .NET Core native module symbols. - name2ee -- Displays the MethodTable structure and EEClass structure for the specified type or method in the specified module. - pe -- Displays and formats fields of any object derived from the Exception class at the specified address. - setclrpath -- Set the path to load coreclr dac/dbi files. setclrpath - sethostruntime -- Sets or displays the .NET Core runtime directory to use to run managed code in SOS. - setsymbolserver -- Enables the symbol server support. - setsostid -- Set the current os tid/thread index instead of using the one lldb provides. setsostid - sos -- Various coreclr debugging commands. See 'soshelp' for more details. sos - soshelp -- Displays all available commands when no parameter is specified, or displays detailed help information about the specified command. soshelp - syncblk -- Displays the SyncBlock holder info. - -## Remarks - -TBD - -## Examples - -The following command displays the contents of an array at the address `00ad28d0`. The display starts from the second element and continues for five elements. - -``` -sos DumpArray -start 2 -length 5 -detail 00ad28d0 -``` - - The following command displays the contents of an assembly at the address `1ca248`. - -``` -sos DumpAssembly 1ca248 -``` - - The following command displays information about the garbage collector heap. - -``` -dumpheap -``` - - The following command writes the contents of the in-memory stress log to a (default) file called StressLog.txt in the current directory. - -``` -dumplog -``` - - The following command displays the `MethodDesc` structure at the address `902f40`. - -``` -dumpmd 902f40 -``` - - The following command displays information about a module at the address `1caa50`. - -``` -dumpmodule 1caa50 -``` - - The following command displays information about an object at the address `a79d40`. - -``` -dumpobj a79d40 -``` - - The following command displays the fields of a value class at the address `00a79d9c` using the method table at the address `0090320c`. - -``` -sos DumpVC 0090320c 00a79d9c -``` - - The following command displays the process memory used by the garbage collector. - -``` -eeheap -gc -``` - - The following command determines the application domain of an object at the address `00a79d98`. - -``` -sos FindAppDomain 00a79d98 -``` - - The following command displays all garbage collector handles in the current process. - -``` -sos GCInfo 5b68dbb8 -``` - - The following command displays the `MethodTable` and `EEClass` structures for the `Main` method in the class `MainClass` in the module `unittest.exe`. - -``` -name2ee unittest.exe MainClass.Main -``` - - The following command displays information about the metadata token at the address `02000003` in the module `unittest.exe`. - -``` -sos Token2EE unittest.exe 02000003 -``` - - The following displays the managed threads and the threadstate for one: - -``` -clrthreads -``` -``` -ThreadCount: 2 -UnstartedThread: 0 -BackgroundThread: 1 -PendingThread: 0 -DeadThread: 0 -Hosted Runtime: no - Lock - ID OSID ThreadOBJ State GC Mode GC Alloc Context Domain Count Apt Exception - 1 1 12fd 0000000000673A90 20020 Cooperative 00007FFF5801D9A0:00007FFF5801E808 0000000000654CD0 0 Ukn - 7 2 1306 0000000000697E90 21220 Preemptive 0000000000000000:0000000000000000 0000000000654CD0 0 Ukn (Finalizer) -(lldb) sos ThreadState 21220 - Legal to Join - Background - CLR Owns - Fully initialized -``` diff --git a/documentation/sos.md b/documentation/sos.md index fe4518d7ac..e4de62587d 100644 --- a/documentation/sos.md +++ b/documentation/sos.md @@ -19,8 +19,7 @@ Getting a version of lldb that works for your platform can be a problem sometime ## Using SOS -* [SOS debugging for Linux/MacOS](sos-debugging-extension.md) -* [SOS debugging for Windows](sos-debugging-extension-windows.md) +* [SOS debugging](https://learn.microsoft.com/dotnet/core/diagnostics/sos-debugging-extension) * [Debugging a core dump](debugging-coredump.md) ## New SOS Features diff --git a/eng/AuxMsbuildFiles/SdkPackOverrides.targets b/eng/AuxMsbuildFiles/SdkPackOverrides.targets index 6251cd2389..710727a87c 100644 --- a/eng/AuxMsbuildFiles/SdkPackOverrides.targets +++ b/eng/AuxMsbuildFiles/SdkPackOverrides.targets @@ -14,13 +14,6 @@ $(MicrosoftNETCoreApp60Version) - - - $(MicrosoftNETCoreApp31Version) - - - $(MicrosoftNETCoreApp31Version) - \ No newline at end of file diff --git a/eng/Build-Native.cmd b/eng/Build-Native.cmd index bf16c8a02e..7af07daa6d 100644 --- a/eng/Build-Native.cmd +++ b/eng/Build-Native.cmd @@ -179,7 +179,7 @@ if /i %__BuildCrossArch% EQU 1 ( echo Generating Version Header set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" - powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs% + powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.proj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED goto ExitWithError @@ -253,7 +253,7 @@ if %__Build% EQU 1 ( echo Generating Version Header set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" - powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs% + powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__ProjectDir%\eng\common\msbuild.ps1" "%__ProjectDir%\eng\CreateVersionFile.proj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /restore /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__ArtifactsIntermediatesDir%\_version.h %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED goto ExitWithError @@ -296,8 +296,9 @@ if %__Build% EQU 1 ( REM Copy the native SOS binaries to where these tools expect for CI & VS testing -set "__dotnet_sos=%__RootBinDir%\bin\dotnet-sos\%__BuildType%\netcoreapp3.1" -set "__dotnet_dump=%__RootBinDir%\bin\dotnet-dump\%__BuildType%\netcoreapp3.1" +set "__targetRid=net6.0" +set "__dotnet_sos=%__RootBinDir%\bin\dotnet-sos\%__BuildType%\%__targetRid%" +set "__dotnet_dump=%__RootBinDir%\bin\dotnet-dump\%__BuildType%\%__targetRid%" mkdir %__dotnet_sos%\win-%__BuildArch% mkdir %__dotnet_sos%\publish\win-%__BuildArch% mkdir %__dotnet_dump%\win-%__BuildArch% diff --git a/eng/CleanupPrivateBuild.csproj b/eng/CleanupPrivateBuild.csproj deleted file mode 100644 index bb22950b13..0000000000 --- a/eng/CleanupPrivateBuild.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - netcoreapp3.1 - - - - - diff --git a/eng/CleanupPrivateBuild.proj b/eng/CleanupPrivateBuild.proj new file mode 100644 index 0000000000..7f48d9c94b --- /dev/null +++ b/eng/CleanupPrivateBuild.proj @@ -0,0 +1,9 @@ + + + netstandard2.0 + false + false + + + + diff --git a/eng/CreateVersionFile.csproj b/eng/CreateVersionFile.proj similarity index 94% rename from eng/CreateVersionFile.csproj rename to eng/CreateVersionFile.proj index f3d5d14912..0ebcdee497 100644 --- a/eng/CreateVersionFile.csproj +++ b/eng/CreateVersionFile.proj @@ -1,8 +1,10 @@ - + - netcoreapp3.1 - + netstandard2.0 + false + false + diff --git a/eng/InstallRuntimes.proj b/eng/InstallRuntimes.proj index eac7bdc378..5e466ed3ad 100644 --- a/eng/InstallRuntimes.proj +++ b/eng/InstallRuntimes.proj @@ -22,7 +22,6 @@ $(MicrosoftAspNetCoreAppRefVersion) - latest dotnet aspnetcore stable version (the version that actually is installed) $(MicrosoftNETCoreApp60Version) $(MicrosoftAspNetCoreApp60Version) - 6.0 version - $(MicrosoftNETCoreApp31Version) $(MicrosoftAspNetCoreApp31Version) - 3.1 version $(SingleFileRuntimeLatestVersion) - The latest version of the runtime used to build single-file apps $(SingleFileRuntime60Version) - The 6.0.x version of the runtime used to build single-file apps @@ -86,7 +85,6 @@ - @@ -153,11 +151,9 @@ Outputs="$(TestConfigFileName)"> - $(MicrosoftNETCoreApp31Version) - $(MicrosoftAspNetCoreApp31Version) - $(MicrosoftNETCoreApp60Version) $(MicrosoftAspNetCoreApp60Version) + diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index c1b6dfbf05..26918f1556 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -1,5 +1,5 @@ - + - + \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 072679f499..be06e827ec 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,21 +1,16 @@ - + https://github.com/dotnet/symstore - 497d5da763d44d34ed577d4ac9db3ce7231a238a + 24c0b5cbb1b1f7a22f7d712bc1ab191e86a00233 - + https://github.com/microsoft/clrmd - 7dab97e3106587f778d4c09ed2cbc2391b6f5354 + 8a56bfb39c3a8361f278a092cebce3f8ac0040cc - + https://github.com/microsoft/clrmd - a64d9ac11086f28fbd4b2b2337c19be7826fbfa9 - - - https://github.com/dotnet/source-build-reference-packages - 31f422237eabbd5c89ecbd0f4a6f53e2c495422f - + 8a56bfb39c3a8361f278a092cebce3f8ac0040cc @@ -28,9 +23,9 @@ https://github.com/dotnet/arcade ccfe6da198c5f05534863bbb1bff66e830e0c6ab - + https://github.com/dotnet/installer - 3c4322d8e5f92a3a2a2d51095c2f06bb1c033b88 + de87c6c89c81daabb218f97f9f715b696a69c394 https://github.com/dotnet/aspnetcore @@ -48,5 +43,15 @@ https://github.com/dotnet/runtime cd2d83798383716204eb580eb5c89ef5b73b8ec2 + + https://github.com/dotnet/source-build-reference-packages + 44c3e166651615f4ae66f0dfa236f082de84d7c5 + + + + https://github.com/dotnet/sourcelink + d047202874ad79d72c75b6354c0f8a9a12d1b054 + + diff --git a/eng/Versions.props b/eng/Versions.props index 7521384ead..5bb84a9a4b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,25 +16,23 @@ - 1.0.405201 + 1.0.407301 - 7.0.0-rtm.22513.12 - 7.0.0 + 7.0.2 + 7.0.2 - 7.0.0-rtm.22513.7 - 7.0.0 + 7.0.2 + 7.0.2 - 7.0.102-servicing.22609.1 + 7.0.103-servicing.23070.16 - 3.1.28 - $(MicrosoftNETCoreApp31Version) 6.0.8 $(MicrosoftNETCoreApp60Version) 6.0.8 - 7.0.0 + 7.0.2 @@ -45,9 +43,9 @@ 4.3.0 1.1.0 - 2.3.363101 + 2.3.405501 16.9.0-beta1.21055.5 - 2.0.64 + 2.0.76 2.1.1 @@ -65,5 +63,7 @@ 7.0.0-beta.22316.2 10.0.18362 13.0.1 + 8.0.0-alpha.1.23061.1 + 1.2.0-beta-22518-02 diff --git a/eng/build.ps1 b/eng/build.ps1 index 722f061bcc..b107d42088 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -53,7 +53,7 @@ if ($bundletools) { # Remove the private build registry keys if ($cleanupprivatebuild) { - Invoke-Expression "& `"$engroot\common\msbuild.ps1`" $engroot\CleanupPrivateBuild.csproj /v:$verbosity /t:CleanupPrivateBuild /p:BuildArch=$architecture /p:TestArchitectures=$architecture" + Invoke-Expression "& `"$engroot\common\msbuild.ps1`" $engroot\CleanupPrivateBuild.proj /v:$verbosity /t:CleanupPrivateBuild /p:BuildArch=$architecture /p:TestArchitectures=$architecture" exit $lastExitCode } diff --git a/eng/build.sh b/eng/build.sh index 654ab0c0f5..08fa93f245 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -48,7 +48,7 @@ handle_arguments() { __ShiftArgs=1 ;; - -binarylog|-bl|-clean|-integrationtest|-pack|-performancetest|-pipelineslog|-pl|-preparemachine|-publish|-r|-rebuild|-restore|-sign) + -binarylog|-bl|-clean|-integrationtest|-pack|-performancetest|-pipelineslog|-pl|-preparemachine|-publish|-r|-rebuild|-restore|-sign|-sb) __ManagedBuildArgs="$__ManagedBuildArgs $1" ;; @@ -63,7 +63,7 @@ handle_arguments() { __ShiftArgs=1 ;; - -clean|-binarylog|-bl|-pipelineslog|-pl|-restore|-r|-rebuild|-pack|-integrationtest|-performancetest|-sign|-publish|-preparemachine) + -clean|-binarylog|-bl|-pipelineslog|-pl|-restore|-r|-rebuild|-pack|-integrationtest|-performancetest|-sign|-publish|-preparemachine|-sb) __ManagedBuildArgs="$__ManagedBuildArgs $1" ;; @@ -131,7 +131,7 @@ mkdir -p "$__IntermediatesDir" mkdir -p "$__LogsDir" mkdir -p "$__CMakeBinDir" -__ExtraCmakeArgs="$__ExtraCmakeArgs -DCLR_MANAGED_BINARY_DIR=$__RootBinDir/bin -DCLR_BUILD_TYPE=$__BuildType" +__ExtraCmakeArgs="$__CMakeArgs $__ExtraCmakeArgs -DCLR_MANAGED_BINARY_DIR=$__RootBinDir/bin -DCLR_BUILD_TYPE=$__BuildType" # Specify path to be set for CMAKE_INSTALL_PREFIX. # This is where all built native libraries will copied to. @@ -202,7 +202,7 @@ if [[ "$__NativeBuild" == 1 ]]; then __GenerateVersionLog="$__LogsDir/GenerateVersion.binlog" "$__RepoRootDir/eng/common/msbuild.sh" \ - $__RepoRootDir/eng/CreateVersionFile.csproj \ + $__RepoRootDir/eng/CreateVersionFile.proj \ /bl:$__GenerateVersionLog \ /t:GenerateVersionFiles \ /restore \ @@ -230,8 +230,9 @@ fi # if [[ "$__NativeBuild" == 1 || "$__Test" == 1 ]]; then - __dotnet_sos=$__RootBinDir/bin/dotnet-sos/$__BuildType/netcoreapp3.1/publish/$__DistroRid - __dotnet_dump=$__RootBinDir/bin/dotnet-dump/$__BuildType/netcoreapp3.1/publish/$__DistroRid + __targetRid=net6.0 + __dotnet_sos=$__RootBinDir/bin/dotnet-sos/$__BuildType/$__targetRid/publish/$__DistroRid + __dotnet_dump=$__RootBinDir/bin/dotnet-dump/$__BuildType/$__targetRid/publish/$__DistroRid mkdir -p "$__dotnet_sos" mkdir -p "$__dotnet_dump" diff --git a/eng/configure-toolset.ps1 b/eng/configure-toolset.ps1 deleted file mode 100644 index 377252c468..0000000000 --- a/eng/configure-toolset.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -# We depend on a local cli for a number of our buildtool -# commands like init-tools so for now we need to disable -# using the globally installed dotnet - -$script:useInstalledDotNetCli = $false - -# Always use the local repo packages directory instead of -# the user's NuGet cache -#$script:useGlobalNuGetCache = $false - -# Working around issue https://github.com/dotnet/arcade/issues/2673 -$script:DisableNativeToolsetInstalls = $true diff --git a/eng/configure-toolset.sh b/eng/configure-toolset.sh deleted file mode 100644 index ca72d0b4e9..0000000000 --- a/eng/configure-toolset.sh +++ /dev/null @@ -1,12 +0,0 @@ -# We depend on a local cli for a number of our buildtool -# commands like init-tools so for now we need to disable -# using the globally installed dotnet - -use_installed_dotnet_cli=false - -# Always use the local repo packages directory instead of -# the user's NuGet cache -#use_global_nuget_cache=false - -# Working around issue https://github.com/dotnet/arcade/issues/2673 -DisableNativeToolsetInstalls=true diff --git a/global.json b/global.json index 248ecac308..8e96bb6033 100644 --- a/global.json +++ b/global.json @@ -1,14 +1,12 @@ { "tools": { - "dotnet": "7.0.100", + "dotnet": "7.0.101", "runtimes": { "dotnet/x64": [ - "$(MicrosoftNETCoreApp31Version)", "$(MicrosoftNETCoreApp60Version)", "$(VSRedistCommonNetCoreSharedFrameworkx6470Version)" ], "dotnet/x86": [ - "$(MicrosoftNETCoreApp31Version)", "$(MicrosoftNETCoreApp60Version)", "$(VSRedistCommonNetCoreSharedFrameworkx6470Version)" ], diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/ElfModule.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/ElfModule.cs index 66f786f496..584f26cc3b 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/ElfModule.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/ElfModule.cs @@ -13,10 +13,8 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation /// /// Disposable ELFFile wrapper around the module file. /// - public class ELFModule : ELFFile, IDisposable + public class ELFModule : ELFFile { - private readonly Stream _stream; - /// /// Opens and returns an ELFFile instance from the local file path /// @@ -48,9 +46,6 @@ public static ELFModule OpenFile(string filePath) public ELFModule(Stream stream) : base(new StreamAddressSpace(stream), position: 0, isDataSourceVirtualAddressSpace: false) { - _stream = stream; } - - public void Dispose() => _stream.Dispose(); } } \ No newline at end of file diff --git a/src/Microsoft.Diagnostics.DebugServices.Implementation/MachOModule.cs b/src/Microsoft.Diagnostics.DebugServices.Implementation/MachOModule.cs index f530888ebe..467f52c8f2 100644 --- a/src/Microsoft.Diagnostics.DebugServices.Implementation/MachOModule.cs +++ b/src/Microsoft.Diagnostics.DebugServices.Implementation/MachOModule.cs @@ -13,10 +13,8 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation /// /// Disposable MachOFile wrapper around the module file. /// - public class MachOModule : MachOFile, IDisposable + public class MachOModule : MachOFile { - private readonly Stream _stream; - /// /// Opens and returns an MachOFile instance from the local file path /// @@ -48,9 +46,6 @@ public static MachOModule OpenFile(string filePath) public MachOModule(Stream stream) : base(new StreamAddressSpace(stream), position: 0, dataSourceIsVirtualAddressSpace: false) { - _stream = stream; } - - public void Dispose() => _stream.Dispose(); } } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/DumpAsyncCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/DumpAsyncCommand.cs index 8f1bb430e7..d09bf213fd 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/DumpAsyncCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/DumpAsyncCommand.cs @@ -459,7 +459,7 @@ bool ShouldIncludeStack(AsyncObject obj) // Outputs a line of information for each instance field on the object. void RenderFields(IAddressableTypedEntity? obj, int depth) { - if (obj is not null) + if (obj?.Type is not null) { string depthTab = new string(' ', depth * TabWidth); @@ -489,33 +489,36 @@ void RenderFields(IAddressableTypedEntity? obj, int depth) // Gets a printable description for the specified object. string Describe(ClrObject obj) { - // Default the description to the type name. - string description = obj.Type.Name; - - if (IsStateMachineBox(obj.Type)) + string description = string.Empty; + if (obj.Type?.Name is not null) { - // Remove the boilerplate box type from the name. - int pos = description.IndexOf("StateMachineBox<", StringComparison.Ordinal); - if (pos >= 0) + // Default the description to the type name. + description = obj.Type.Name; + + if (IsStateMachineBox(obj.Type)) { - ReadOnlySpan slice = description.AsSpan(pos + "StateMachineBox<".Length); - slice = slice.Slice(0, slice.Length - 1); // remove trailing > - description = slice.ToString(); + // Remove the boilerplate box type from the name. + int pos = description.IndexOf("StateMachineBox<", StringComparison.Ordinal); + if (pos >= 0) + { + ReadOnlySpan slice = description.AsSpan(pos + "StateMachineBox<".Length); + slice = slice.Slice(0, slice.Length - 1); // remove trailing > + description = slice.ToString(); + } } - } - else if (TryGetValidObjectField(obj, "m_action", out ClrObject taskDelegate)) - { - // If we can figure out what the task's delegate points to, append the method signature. - if (TryGetMethodFromDelegate(runtime, taskDelegate, out ClrMethod? method)) + else if (TryGetValidObjectField(obj, "m_action", out ClrObject taskDelegate)) + { + // If we can figure out what the task's delegate points to, append the method signature. + if (TryGetMethodFromDelegate(runtime, taskDelegate, out ClrMethod? method)) + { + description = $"{description} {{{method!.Signature}}}"; + } + } + else if (obj.Address != 0 && taskCompletionSentinel.Address == obj.Address) { - description = $"{description} {{{method!.Signature}}}"; + description = "TaskCompletionSentinel"; } } - else if (obj.Address != 0 && taskCompletionSentinel.Address == obj.Address) - { - description = "TaskCompletionSentinel"; - } - return description; } @@ -527,14 +530,17 @@ bool IncludeInOutput(ClrObject obj) return false; } - if (MethodTableAddress is ulong mt && obj.Type.MethodTable != mt) + if (obj.Type is not null) { - return false; - } + if (MethodTableAddress is ulong mt && obj.Type.MethodTable != mt) + { + return false; + } - if (NameSubstring is not null && !obj.Type.Name.Contains(NameSubstring)) - { - return false; + if (NameSubstring is not null && obj.Type.Name is not null && !obj.Type.Name.Contains(NameSubstring)) + { + return false; + } } return true; @@ -655,37 +661,42 @@ Dictionary CollectObjects() // void AddContinuation(ClrObject continuation, List continuations) { - if (continuation.Type.Name.StartsWith("System.Collections.Generic.List<", StringComparison.Ordinal)) + if (continuation.Type is not null) { - if (continuation.Type.GetFieldByName("_items") is ClrInstanceField itemsField) + if (continuation.Type.Name is not null && + continuation.Type.Name.StartsWith("System.Collections.Generic.List<", StringComparison.Ordinal)) { - ClrObject itemsObj = itemsField.ReadObject(continuation.Address, interior: false); - if (!itemsObj.IsNull) + if (continuation.Type.GetFieldByName("_items") is ClrInstanceField itemsField) { - ClrArray items = itemsObj.AsArray(); - if (items.Rank == 1) + ClrObject itemsObj = itemsField.ReadObject(continuation.Address, interior: false); + if (!itemsObj.IsNull) { - for (int i = 0; i < items.Length; i++) + ClrArray items = itemsObj.AsArray(); + if (items.Rank == 1) { - if (items.GetObjectValue(i) is ClrObject { IsValid: true } c) + for (int i = 0; i < items.Length; i++) { - continuations.Add(ResolveContinuation(c)); + if (items.GetObjectValue(i) is ClrObject { IsValid: true } c) + { + continuations.Add(ResolveContinuation(c)); + } } } } } } - } - else - { - continuations.Add(continuation); + else + { + continuations.Add(continuation); + } } } // Tries to get the object contents of a Task's continuations field bool TryGetContinuation(ClrObject obj, out ClrObject continuation) { - if (obj.Type.GetFieldByName("m_continuationObject") is ClrInstanceField continuationObjectField && + if (obj.Type is not null && + obj.Type.GetFieldByName("m_continuationObject") is ClrInstanceField continuationObjectField && continuationObjectField.ReadObject(obj.Address, interior: false) is ClrObject { IsValid: true } continuationObject) { continuation = ResolveContinuation(continuationObject); @@ -888,7 +899,7 @@ private void WriteCodeLink(ulong address) } /// Gets whether the specified type is an AsyncStateMachineBox{T}. - private static bool IsStateMachineBox(ClrType type) + private static bool IsStateMachineBox(ClrType? type) { // Ideally we would compare the metadata token and module for the generic template for the type, // but that information isn't fully available via ClrMd, nor can it currently find DebugFinalizableAsyncStateMachineBox diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs index b3c4af85ab..fc83c22c98 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentDictionaryCommand.cs @@ -8,7 +8,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "dumpconcurrentdictionary", Aliases = new string[] { "dcd" }, Help = "Display concurrent dictionary content.")] + [Command(Name = "dumpconcurrentdictionary", Aliases = new string[] { "dcd" }, Help = "Displays concurrent dictionary content.")] public class DumpConcurrentDictionaryCommand : ExtensionCommandBase { [Argument(Help = "The address of a ConcurrentDictionary object.")] diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentQueueCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentQueueCommand.cs index f886b5b923..ea7b0a70df 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentQueueCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/DumpConcurrentQueueCommand.cs @@ -8,7 +8,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "dumpconcurrentqueue", Aliases = new string[] { "dcq" }, Help = "Display concurrent queue content.")] + [Command(Name = "dumpconcurrentqueue", Aliases = new string[] { "dcq" }, Help = "Displays concurrent queue content.")] public class DumpConcurrentQueueCommand : ExtensionCommandBase { [Argument(Help = "The address of a ConcurrentQueue object.")] diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/ConsoleLoggingCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/ConsoleLoggingCommand.cs index 18eb2cb87b..221f469a18 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/ConsoleLoggingCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/ConsoleLoggingCommand.cs @@ -6,8 +6,8 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "logopen", Help = "Enable console file logging", Flags = CommandFlags.Global)] - [Command(Name = "logclose", DefaultOptions = "--disable", Help = "Disable console file logging", Flags = CommandFlags.Global)] + [Command(Name = "logopen", Help = "Enables console file logging.", Flags = CommandFlags.Global)] + [Command(Name = "logclose", DefaultOptions = "--disable", Help = "Disables console file logging.", Flags = CommandFlags.Global)] public class ConsoleLoggingCommand : CommandBase { public IConsoleFileLoggingService FileLoggingService { get; set; } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/LoggingCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/LoggingCommand.cs index 11f969b8d8..4732ab1bb1 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/LoggingCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/LoggingCommand.cs @@ -10,7 +10,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "logging", Help = "Enable/disable internal diagnostic logging", Flags = CommandFlags.Global)] + [Command(Name = "logging", Help = "Enables/disables internal diagnostic logging.", Flags = CommandFlags.Global)] public class LoggingCommand : CommandBase { public IDiagnosticLoggingService DiagnosticLoggingService { get; set; } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs index 40820a0e25..b88dd18efa 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/RuntimesCommand.cs @@ -4,15 +4,12 @@ using Microsoft.Diagnostics.DebugServices; using Microsoft.Diagnostics.Runtime; -using System; using System.Collections.Immutable; using System.Linq; -using System.Runtime.InteropServices; -using System.Text; namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "runtimes", Help = "List the runtimes in the target or change the default runtime.")] + [Command(Name = "runtimes", Help = "Lists the runtimes in the target or changes the default runtime.")] public class RuntimesCommand : CommandBase { public IRuntimeService RuntimeService { get; set; } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetClrPathCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetClrPathCommand.cs index e7979568c4..1191419d59 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetClrPathCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetClrPathCommand.cs @@ -7,7 +7,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "setclrpath", Help = "Set the path to load coreclr DAC/DBI files.")] + [Command(Name = "setclrpath", Help = "Sets the path to load coreclr DAC/DBI files.")] public class SetClrPath: CommandBase { public IRuntime Runtime { get; set; } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs index eaf0797af8..46484519d1 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs @@ -9,12 +9,12 @@ namespace Microsoft.Diagnostics.ExtensionCommands [Command( Name = "setsymbolserver", Aliases = new string[] { "SetSymbolServer" }, - Help = "Enable and set symbol server support for symbols and module download", + Help = "Enables and sets symbol server support for symbols and module download.", Flags = CommandFlags.Global)] [Command( Name = "loadsymbols", DefaultOptions = "--loadsymbols", - Help = "Load symbols for all modules", + Help = "Loads symbols for all modules.", Flags = CommandFlags.Global)] public class SetSymbolServerCommand : CommandBase { diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs index 0ea5401076..cbc7414b63 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/Host/StatusCommand.cs @@ -7,7 +7,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "sosstatus", Help = "Display internal status or reset the internal cached state.")] + [Command(Name = "sosstatus", Help = "Displays internal status or resets the internal cached state.")] public class StatusCommand : CommandBase { public ITarget Target { get; set; } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/ParallelStacksCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/ParallelStacksCommand.cs index ba07cac25c..43db291e18 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/ParallelStacksCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/ParallelStacksCommand.cs @@ -9,7 +9,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "parallelstacks", Aliases = new string[] { "pstacks" }, Help = "Display merged threads stack a la Visual Studio 'Parallel Stacks' panel.")] + [Command(Name = "parallelstacks", Aliases = new string[] { "pstacks" }, Help = "Displays the merged threads stack similarly to the Visual Studio 'Parallel Stacks' panel.")] public class ParallelStacksCommand : ExtensionCommandBase { public ClrRuntime Runtime { get; set; } diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/TaskStateCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/TaskStateCommand.cs index 0a41b18982..ee67f6c15c 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/TaskStateCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/TaskStateCommand.cs @@ -7,7 +7,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "taskstate", Aliases = new string[] { "tks" }, Help = "Display a Task state in a human readable format.")] + [Command(Name = "taskstate", Aliases = new string[] { "tks" }, Help = "Displays a Task state in a human readable format.")] public class TaskStateCommand : ExtensionCommandBase { [Argument(Help = "The Task instance address.")] diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/ThreadPoolQueueCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/ThreadPoolQueueCommand.cs index 73b26e343c..c2c9de50c4 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/ThreadPoolQueueCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/ThreadPoolQueueCommand.cs @@ -9,7 +9,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "threadpoolqueue", Aliases = new string[] { "tpq" }, Help = "Display queued ThreadPool work items.")] + [Command(Name = "threadpoolqueue", Aliases = new string[] { "tpq" }, Help = "Displays queued ThreadPool work items.")] public class ThreadPoolQueueCommand : ExtensionCommandBase { public override void ExtensionInvoke() diff --git a/src/Microsoft.Diagnostics.ExtensionCommands/TimersCommand.cs b/src/Microsoft.Diagnostics.ExtensionCommands/TimersCommand.cs index cf415baa14..3ebf1e3ab7 100644 --- a/src/Microsoft.Diagnostics.ExtensionCommands/TimersCommand.cs +++ b/src/Microsoft.Diagnostics.ExtensionCommands/TimersCommand.cs @@ -9,7 +9,7 @@ namespace Microsoft.Diagnostics.ExtensionCommands { - [Command(Name = "timerinfo", Aliases = new string[] { "ti" }, Help = "Display running timers details.")] + [Command(Name = "timerinfo", Aliases = new string[] { "ti" }, Help = "Displays information about running timers.")] public class TimersCommand : ExtensionCommandBase { public override void ExtensionInvoke() diff --git a/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs b/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs index c4cb1eab00..22a89e45cd 100644 --- a/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs +++ b/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs @@ -305,9 +305,9 @@ internal async Task> GetProcessEnvironmentAsync(Cance /// public static IEnumerable GetPublishedProcesses() { - static IEnumerable GetAllPublishedProcesses() + static IEnumerable GetAllPublishedProcesses(string[] files) { - foreach (var port in Directory.GetFiles(PidIpcEndpoint.IpcRootPath)) + foreach (var port in files) { var fileName = new FileInfo(port).Name; var match = Regex.Match(fileName, PidIpcEndpoint.DiagnosticsPortPattern); @@ -319,8 +319,22 @@ static IEnumerable GetAllPublishedProcesses() yield return processId; } } - - return GetAllPublishedProcesses().Distinct(); + try + { + string[] files = Directory.GetFiles(PidIpcEndpoint.IpcRootPath); + return GetAllPublishedProcesses(files).Distinct(); + } + catch ( UnauthorizedAccessException ex) + { + if (PidIpcEndpoint.IpcRootPath.StartsWith(@"\\.\pipe")) + { + throw new DiagnosticsClientException($"Enumerating {PidIpcEndpoint.IpcRootPath} is not authorized", ex); + } + else + { + throw; + } + } } internal ProcessInfo GetProcessInfo() diff --git a/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClientExceptions.cs b/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClientExceptions.cs index fa9aec630c..efcea1c432 100644 --- a/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClientExceptions.cs +++ b/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClientExceptions.cs @@ -8,6 +8,7 @@ namespace Microsoft.Diagnostics.NETCore.Client public class DiagnosticsClientException : Exception { public DiagnosticsClientException(string msg) : base(msg) {} + public DiagnosticsClientException(string msg, Exception exception) : base(msg, exception) {} } // When a certian command is not supported by either the library or the target process' runtime diff --git a/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj b/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj index 3d097fafcb..ff2856f1c2 100644 --- a/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj +++ b/src/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj @@ -1,7 +1,8 @@  Library - netstandard2.0;netcoreapp3.1 + netstandard2.0;net6.0 + netstandard2.0 Microsoft.Diagnostics.NETCore.Client .NET Core Diagnostics Client Library 0.2.0 diff --git a/src/Microsoft.Diagnostics.Repl/ExitCommand.cs b/src/Microsoft.Diagnostics.Repl/ExitCommand.cs index 4d4eb4eee1..1edbd41665 100644 --- a/src/Microsoft.Diagnostics.Repl/ExitCommand.cs +++ b/src/Microsoft.Diagnostics.Repl/ExitCommand.cs @@ -7,7 +7,7 @@ namespace Microsoft.Diagnostics.Repl { - [Command(Name = "exit", Aliases = new string[] { "quit", "q" }, Help = "Exit interactive mode.", Flags = CommandFlags.Global | CommandFlags.Manual)] + [Command(Name = "exit", Aliases = new string[] { "quit", "q" }, Help = "Exits interactive mode.", Flags = CommandFlags.Global | CommandFlags.Manual)] public class ExitCommand : CommandBase { private readonly Action _exit; diff --git a/src/Microsoft.Diagnostics.Repl/HelpCommand.cs b/src/Microsoft.Diagnostics.Repl/HelpCommand.cs index b4153706f4..30f1b63ccd 100644 --- a/src/Microsoft.Diagnostics.Repl/HelpCommand.cs +++ b/src/Microsoft.Diagnostics.Repl/HelpCommand.cs @@ -7,7 +7,7 @@ namespace Microsoft.Diagnostics.Repl { - [Command(Name = "help", Help = "Display help for a command.", Flags = CommandFlags.Global | CommandFlags.Manual)] + [Command(Name = "help", Help = "Displays help for a command.", Flags = CommandFlags.Global | CommandFlags.Manual)] public class HelpCommand : CommandBase { [Argument(Help = "Command to find help.")] diff --git a/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs b/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs index e5b088231a..b078b6c34e 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs +++ b/src/Microsoft.Diagnostics.TestHelpers/AcquireDotNetTestStep.cs @@ -5,7 +5,7 @@ using System; using System.IO; using System.IO.Compression; -using System.Net; +using System.Net.Http; using System.Threading.Tasks; using Xunit.Abstractions; @@ -133,28 +133,17 @@ async protected override Task DoWork(ITestOutputHelper output) async static Task DownloadFile(string remotePath, string localPath, ITestOutputHelper output) { output.WriteLine("Downloading: " + remotePath + " -> " + localPath); + using HttpClient client = new (); + using HttpResponseMessage response = await client.GetAsync(remotePath); + response.EnsureSuccessStatusCode(); + using Stream stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); Directory.CreateDirectory(Path.GetDirectoryName(localPath)); - WebRequest request = HttpWebRequest.Create(remotePath); - WebResponse response = await request.GetResponseAsync(); - using (FileStream localZipStream = File.OpenWrite(localPath)) - { - // TODO: restore the CopyToAsync code after System.Net.Http.dll is - // updated to a newer version. The current old version has a bug - // where the copy never finished. - // await response.GetResponseStream().CopyToAsync(localZipStream); - byte[] buffer = new byte[16 * 1024]; - long bytesLeft = response.ContentLength; - - while (bytesLeft > 0) - { - int read = response.GetResponseStream().Read(buffer, 0, buffer.Length); - if (read == 0) - break; - localZipStream.Write(buffer, 0, read); - bytesLeft -= read; - } - output.WriteLine("Downloading finished"); - } + using FileStream localZipStream = File.OpenWrite(localPath); + // TODO: restore the CopyToAsync code after System.Net.Http.dll is + // updated to a newer version. The current old version has a bug + // where the copy never finished. + await stream.CopyToAsync(localZipStream); + output.WriteLine("Downloading finished"); } async static Task UnGZip(string gzipPath, string expandedFilePath, ITestOutputHelper output) diff --git a/src/Microsoft.Diagnostics.TestHelpers/CliDebuggeeCompiler.cs b/src/Microsoft.Diagnostics.TestHelpers/CliDebuggeeCompiler.cs index c1ec9a9023..2f1a51873e 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/CliDebuggeeCompiler.cs +++ b/src/Microsoft.Diagnostics.TestHelpers/CliDebuggeeCompiler.cs @@ -52,7 +52,7 @@ private static Dictionary GetBuildProperties(TestConfiguration co protected override string GetFramework(TestConfiguration config) { - return config.BuildProjectFramework ?? "netcoreapp3.1"; + return config.BuildProjectFramework ?? "net6.0"; } protected override string GetDebuggeeBinaryDirPath(string debuggeeProjectDirPath, string framework, string runtime) diff --git a/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj b/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj index f2d83c5aa1..d1316d1f77 100644 --- a/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj +++ b/src/Microsoft.Diagnostics.TestHelpers/Microsoft.Diagnostics.TestHelpers.csproj @@ -1,6 +1,6 @@ - netcoreapp3.1 + net6.0 true ;1591;1701 false diff --git a/src/SOS/SOS.Hosting/Commands/SOSCommand.cs b/src/SOS/SOS.Hosting/Commands/SOSCommand.cs index 71203f26aa..b196c5cdd2 100644 --- a/src/SOS/SOS.Hosting/Commands/SOSCommand.cs +++ b/src/SOS/SOS.Hosting/Commands/SOSCommand.cs @@ -10,16 +10,16 @@ namespace SOS.Hosting { - [Command(Name = "analyzeoom", DefaultOptions = "AnalyzeOOM", Help = "Displays the info of the last OOM occurred on an allocation request to the GC heap.")] + [Command(Name = "analyzeoom", DefaultOptions = "AnalyzeOOM", Help = "Displays the info of the last OOM that occurred on an allocation request to the GC heap.")] [Command(Name = "clrstack", DefaultOptions = "ClrStack", Help = "Provides a stack trace of managed code only.")] - [Command(Name = "clrthreads", DefaultOptions = "Threads", Help = "List the managed threads running.")] - [Command(Name = "dbgout", DefaultOptions = "dbgout", Help = "Enable/disable (-off) internal SOS logging.")] + [Command(Name = "clrthreads", DefaultOptions = "Threads", Help = "Lists the managed threads running.")] + [Command(Name = "dbgout", DefaultOptions = "dbgout", Help = "Enables/disables (-off) internal SOS logging.")] [Command(Name = "dumpalc", DefaultOptions = "DumpALC", Help = "Displays details about a collectible AssemblyLoadContext into which the specified object is loaded.")] [Command(Name = "dumparray", DefaultOptions = "DumpArray", Help = "Displays details about a managed array.")] [Command(Name = "dumpassembly", DefaultOptions = "DumpAssembly", Help = "Displays details about an assembly.")] [Command(Name = "dumpclass", DefaultOptions = "DumpClass", Help = "Displays information about a EE class structure at the specified address.")] [Command(Name = "dumpdelegate", DefaultOptions = "DumpDelegate", Help = "Displays information about a delegate.")] - [Command(Name = "dumpdomain", DefaultOptions = "DumpDomain", Help = "Displays information all the AppDomains and all assemblies within the domains.")] + [Command(Name = "dumpdomain", DefaultOptions = "DumpDomain", Help = "Displays the Microsoft intermediate language (MSIL) that's associated with a managed method.")] [Command(Name = "dumpgcdata", DefaultOptions = "DumpGCData", Help = "Displays information about the GC data.")] [Command(Name = "dumpheap", DefaultOptions = "DumpHeap", Help = "Displays info about the garbage-collected heap and collection statistics about objects.")] [Command(Name = "dumpil", DefaultOptions = "DumpIL", Help = "Displays the Microsoft intermediate language (MSIL) that is associated with a managed method.")] @@ -28,22 +28,22 @@ namespace SOS.Hosting [Command(Name = "dumpmodule", DefaultOptions = "DumpModule", Help = "Displays information about a EE module structure at the specified address.")] [Command(Name = "dumpmt", DefaultOptions = "DumpMT", Help = "Displays information about a method table at the specified address.")] [Command(Name = "dumpobj", DefaultOptions = "DumpObj", Aliases = new string[] { "do" }, Help = "Displays info about an object at the specified address.")] - [Command(Name = "dumpruntimetypes", DefaultOptions = "DumpRuntimeTypes", Help = "Finds all System.RuntimeType objects in the gc heap and prints the type name and MethodTable they refer too.")] - [Command(Name = "dumpsig", DefaultOptions = "DumpSig", Help = "This command dumps the signature of a method or field given by .")] - [Command(Name = "dumpsigelem", DefaultOptions = "DumpSigElem", Help = "This command dumps a single element of a signature object.")] + [Command(Name = "dumpruntimetypes", DefaultOptions = "DumpRuntimeTypes", Help = "Finds all System.RuntimeType objects in the GC heap and prints the type name and MethodTable they refer too.")] + [Command(Name = "dumpsig", DefaultOptions = "DumpSig", Help = "Dumps the signature of a method or field specified by .")] + [Command(Name = "dumpsigelem", DefaultOptions = "DumpSigElem", Help = "Dumps a single element of a signature object.")] [Command(Name = "dumpstackobjects", DefaultOptions = "DumpStackObjects", Aliases = new string[] { "dso" }, Help = "Displays all managed objects found within the bounds of the current stack.")] [Command(Name = "dumpvc", DefaultOptions = "DumpVC", Help = "Displays info about the fields of a value class.")] [Command(Name = "eeheap", DefaultOptions = "EEHeap", Help = "Displays info about process memory consumed by internal runtime data structures.")] [Command(Name = "eeversion", DefaultOptions = "EEVersion", Help = "Displays information about the runtime version.")] - [Command(Name = "ehinfo", DefaultOptions = "EHInfo", Help = "Displays the exception handling blocks in a jitted method.")] + [Command(Name = "ehinfo", DefaultOptions = "EHInfo", Help = "Displays the exception handling blocks in a JIT-ed method.")] [Command(Name = "enummem", DefaultOptions = "enummem", Help = "ICLRDataEnumMemoryRegions.EnumMemoryRegions test command.")] [Command(Name = "finalizequeue", DefaultOptions = "FinalizeQueue", Help = "Displays all objects registered for finalization.")] [Command(Name = "findappdomain", DefaultOptions = "FindAppDomain", Help = "Attempts to resolve the AppDomain of a GC object.")] [Command(Name = "gchandles", DefaultOptions = "GCHandles", Help = "Provides statistics about GCHandles in the process.")] - [Command(Name = "gcheapstat", DefaultOptions = "GCHeapStat", Help = "Display various GC heap stats.")] + [Command(Name = "gcheapstat", DefaultOptions = "GCHeapStat", Help = "Displays various GC heap stats.")] [Command(Name = "gcroot", DefaultOptions = "GCRoot", Help = "Displays info about references (or roots) to an object at the specified address.")] - [Command(Name = "gcinfo", DefaultOptions = "GCInfo", Help = "Displays info JIT GC encoding for a method.")] - [Command(Name = "gcwhere", DefaultOptions = "GCWhere", Help = "Displays the location in the GC heap of the argument passed in.")] + [Command(Name = "gcinfo", DefaultOptions = "GCInfo", Help = "Displays JIT GC encoding for a method.")] + [Command(Name = "gcwhere", DefaultOptions = "GCWhere", Help = "Displays the location in the GC heap of the specified address.")] [Command(Name = "histclear", DefaultOptions = "HistClear", Help = "Releases any resources used by the family of Hist commands.")] [Command(Name = "histinit", DefaultOptions = "HistInit", Help = "Initializes the SOS structures from the stress log saved in the debuggee.")] [Command(Name = "histobj", DefaultOptions = "HistObj", Help = "Examines all stress log relocation records and displays the chain of garbage collection relocations that may have led to the address passed in as an argument.")] @@ -51,7 +51,7 @@ namespace SOS.Hosting [Command(Name = "histroot", DefaultOptions = "HistRoot", Help = "Displays information related to both promotions and relocations of the specified root.")] [Command(Name = "histstats", DefaultOptions = "HistStats", Help = "Displays stress log stats.")] [Command(Name = "ip2md", DefaultOptions = "IP2MD", Help = "Displays the MethodDesc structure at the specified address in code that has been JIT-compiled.")] - [Command(Name = "listnearobj", DefaultOptions = "ListNearObj", Help = "Displays the object preceding and succeeding the address specified.")] + [Command(Name = "listnearobj", DefaultOptions = "ListNearObj", Help = "Displays the object preceding and succeeding the specified address.")] [Command(Name = "name2ee", DefaultOptions = "Name2EE", Help = "Displays the MethodTable structure and EEClass structure for the specified type or method in the specified module.")] [Command(Name = "objsize", DefaultOptions = "ObjSize", Help = "Lists the sizes of the all the objects found on managed threads.")] [Command(Name = "pathto", DefaultOptions = "PathTo", Help = "Displays the GC path from to .")] diff --git a/src/SOS/SOS.UnitTests/ConfigFiles/Unix/Debugger.Tests.Config.txt b/src/SOS/SOS.UnitTests/ConfigFiles/Unix/Debugger.Tests.Config.txt index 873b2f3b36..c29ae7de11 100644 --- a/src/SOS/SOS.UnitTests/ConfigFiles/Unix/Debugger.Tests.Config.txt +++ b/src/SOS/SOS.UnitTests/ConfigFiles/Unix/Debugger.Tests.Config.txt @@ -25,9 +25,7 @@ false net7.0 - net5.0 net6.0 - netcoreapp3.1 $(RepoRootDir)/src/SOS/SOS.UnitTests/Debuggees $(RepoRootDir)/eng/AuxMsbuildFiles @@ -80,11 +78,6 @@ net6.0 $(RuntimeVersion60) - @@ -117,10 +110,6 @@ net6.0 $(RuntimeVersion60) - @@ -133,10 +127,6 @@ net6.0 $(RuntimeVersion60) - @@ -51,5 +46,5 @@ --fx-version $(RuntimeFrameworkVersion) $(DotNetRoot)/dotnet - $(RootBinDir)/bin/dotnet-trace/$(TargetConfiguration)/netcoreapp3.1/dotnet-trace.dll + $(RootBinDir)/bin/dotnet-trace/$(TargetConfiguration)/net6.0/dotnet-trace.dll diff --git a/src/tests/CommonTestRunner/ConfigFiles/Windows/Debugger.Tests.Config.txt b/src/tests/CommonTestRunner/ConfigFiles/Windows/Debugger.Tests.Config.txt index ea51d1d00f..704c426a2c 100644 --- a/src/tests/CommonTestRunner/ConfigFiles/Windows/Debugger.Tests.Config.txt +++ b/src/tests/CommonTestRunner/ConfigFiles/Windows/Debugger.Tests.Config.txt @@ -12,7 +12,6 @@ net7.0 net6.0 net5.0 - netcoreapp3.1 ProjectK $(RepoRootDir)\src\tests @@ -39,10 +38,6 @@ net6.0 $(RuntimeVersion60) - @@ -50,5 +45,5 @@ --fx-version $(RuntimeFrameworkVersion) $(DotNetRoot)\dotnet.exe - $(RootBinDir)\bin\dotnet-trace\$(TargetConfiguration)\netcoreapp3.1\dotnet-trace.dll + $(RootBinDir)\bin\dotnet-trace\$(TargetConfiguration)\net6.0\dotnet-trace.dll diff --git a/src/tests/DacCompareNativeTypes/DacCompareNativeTypes.csproj b/src/tests/DacCompareNativeTypes/DacCompareNativeTypes.csproj index c73e0d1692..41f1d5ad4b 100644 --- a/src/tests/DacCompareNativeTypes/DacCompareNativeTypes.csproj +++ b/src/tests/DacCompareNativeTypes/DacCompareNativeTypes.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/tests/DbgShim.UnitTests/DbgShimTests.cs b/src/tests/DbgShim.UnitTests/DbgShimTests.cs index d66536a9ca..925403a312 100644 --- a/src/tests/DbgShim.UnitTests/DbgShimTests.cs +++ b/src/tests/DbgShim.UnitTests/DbgShimTests.cs @@ -20,6 +20,10 @@ using Xunit.Abstractions; using Xunit.Extensions; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics { public class DbgShimTests : IDisposable diff --git a/src/tests/Directory.Build.props b/src/tests/Directory.Build.props index eaf4b4e2f5..fe30b78e06 100644 --- a/src/tests/Directory.Build.props +++ b/src/tests/Directory.Build.props @@ -4,13 +4,7 @@ $(Platform) $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant) - - - true - false - - netcoreapp3.1;net6.0;net7.0 - net6.0;net7.0 + net6.0;net7.0 diff --git a/src/tests/EventPipeTracee/EventPipeTracee.csproj b/src/tests/EventPipeTracee/EventPipeTracee.csproj index 0d7605719e..fad4801e17 100644 --- a/src/tests/EventPipeTracee/EventPipeTracee.csproj +++ b/src/tests/EventPipeTracee/EventPipeTracee.csproj @@ -2,7 +2,7 @@ Exe $(BuildProjectFramework) - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/tests/ExitCodeTracee/ExitCodeTracee.csproj b/src/tests/ExitCodeTracee/ExitCodeTracee.csproj index 6b634ef181..05388fd5f4 100644 --- a/src/tests/ExitCodeTracee/ExitCodeTracee.csproj +++ b/src/tests/ExitCodeTracee/ExitCodeTracee.csproj @@ -2,6 +2,6 @@ Exe $(BuildProjectFramework) - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/tests/Grape/Grape.csproj b/src/tests/Grape/Grape.csproj index 4b033d9a1d..e72911e15d 100644 --- a/src/tests/Grape/Grape.csproj +++ b/src/tests/Grape/Grape.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs index b612ffbf69..ca975fb9c9 100644 --- a/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs +++ b/src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/DebugServicesTests.cs @@ -11,6 +11,10 @@ using Xunit.Abstractions; using Xunit.Extensions; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.DebugServices.UnitTests { public class DebugServicesTests : IDisposable diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs index bfb15c6b6b..c392582ce2 100644 --- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs +++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterPipelineUnitTests.cs @@ -13,6 +13,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests { public class EventCounterPipelineUnitTests diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs index 551e53e4b2..80f05d4911 100644 --- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs +++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventCounterTriggerTests.cs @@ -10,7 +10,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Globalization; -using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -18,6 +17,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests { public class EventCounterTriggerTests diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs index 4d91d2c29d..505ba69d20 100644 --- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs +++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs @@ -18,6 +18,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests { public class EventLogsPipelineUnitTests diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs index 8c88286e28..dc750bd799 100644 --- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs +++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventTracePipelineUnitTests.cs @@ -17,6 +17,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests { public class EventTracePipelineUnitTests diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs index 1a3c39212e..6efc9739f3 100644 --- a/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs +++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/EventPipeSessionTests.cs @@ -14,6 +14,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.NETCore.Client { public class EventPipeSessionTests diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs index d191b42e20..746f8cd70e 100644 --- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs +++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessEnvironmentTests.cs @@ -10,6 +10,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.NETCore.Client { public class ProcessEnvironmentTests diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs index 2b986fabf8..d61819b2bc 100644 --- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs +++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetProcessInfoTests.cs @@ -13,6 +13,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.NETCore.Client { public class GetProcessInfoTests diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs index ff77348124..8a3185db25 100644 --- a/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs +++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/GetPublishedProcessesTests.cs @@ -5,7 +5,6 @@ using Microsoft.Diagnostics.TestHelpers; using System; using System.Collections.Generic; -using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -13,6 +12,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.NETCore.Client { diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs index 4576994396..595e140adf 100644 --- a/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs +++ b/src/tests/Microsoft.Diagnostics.NETCore.Client/ReversedServerTests.cs @@ -19,6 +19,10 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.NETCore.Client { public class ReversedServerTests diff --git a/src/tests/StackTracee/StackTracee.csproj b/src/tests/StackTracee/StackTracee.csproj index 6b634ef181..05388fd5f4 100644 --- a/src/tests/StackTracee/StackTracee.csproj +++ b/src/tests/StackTracee/StackTracee.csproj @@ -2,6 +2,6 @@ Exe $(BuildProjectFramework) - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/tests/Tracee/Tracee.csproj b/src/tests/Tracee/Tracee.csproj index 6b634ef181..05388fd5f4 100644 --- a/src/tests/Tracee/Tracee.csproj +++ b/src/tests/Tracee/Tracee.csproj @@ -2,6 +2,6 @@ Exe $(BuildProjectFramework) - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 diff --git a/src/tests/benchmarks/benchmarks.csproj b/src/tests/benchmarks/benchmarks.csproj index 59e56dcba3..5173a12603 100644 --- a/src/tests/benchmarks/benchmarks.csproj +++ b/src/tests/benchmarks/benchmarks.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/tests/dotnet-counters/JSONExporterTests.cs b/src/tests/dotnet-counters/JSONExporterTests.cs index d60197dd33..6ffc1e92de 100644 --- a/src/tests/dotnet-counters/JSONExporterTests.cs +++ b/src/tests/dotnet-counters/JSONExporterTests.cs @@ -4,12 +4,13 @@ using System; using System.IO; -using System.Collections.Generic; using Xunit; using Microsoft.Diagnostics.Tools.Counters.Exporters; using Newtonsoft.Json; using Microsoft.Diagnostics.Tools.Counters; +#pragma warning disable CA1507 // Use nameof to express symbol names + namespace DotnetCounters.UnitTests { /// diff --git a/src/tests/dotnet-trace/ChildProcessTests.cs b/src/tests/dotnet-trace/ChildProcessTests.cs index 35a003046f..216483914e 100644 --- a/src/tests/dotnet-trace/ChildProcessTests.cs +++ b/src/tests/dotnet-trace/ChildProcessTests.cs @@ -12,9 +12,12 @@ using Xunit.Extensions; using TestRunner = Microsoft.Diagnostics.CommonTestRunner.TestRunner; +// Newer SDKs flag MemberData(nameof(Configurations)) with this error +// Avoid unnecessary zero-length array allocations. Use Array.Empty() instead. +#pragma warning disable CA1825 + namespace Microsoft.Diagnostics.Tools.Trace { - public class ChildProcessTests { public static IEnumerable Configurations => TestRunner.Configurations;