dotnet-inspect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

dotnet-inspect

dotnet-inspect

Use dotnet-inspect for evidence instead of guesses about .NET packages, platform libraries, assemblies, APIs, dependencies, or API version diffs.
bash
dnx dotnet-inspect -y -- <command>
-y
skips interactive confirmation, including after package updates;
--
sends remaining options to dotnet-inspect, so
--help
does not show
dnx
help.
无需猜测,使用dotnet-inspect获取关于.NET包、平台库、程序集、API、依赖项或API版本差异的可靠依据。
bash
dnx dotnet-inspect -y -- <command>
-y
参数会跳过交互式确认,包括包更新后的确认;
--
用于将后续选项传递给dotnet-inspect,因此使用
--help
时不会显示
dnx
的帮助信息。

Common starts

常用起始命令

GoalCommand
Find an API
find Pattern
includes platform/BCL types; add
--project path/to/project
when project references should be in scope.
Inspect a type
type Type --package Foo
; add
--all
for non-public/hidden members.
Inspect overloads
member Type --platform Lib -m Name -S "Member Index"
Select an overload
member Type --platform Lib Name:1
or
Name~digest
Compare APIs
diff --package Foo@old..new --breaking
(
--additive
new APIs);
--alloc-regressions
for perf regressions (allocations up, hot first).
Trace API evolution
timeline --package Foo@old..new --type Type --members --at all
; omit
--at
to inspect the vector without acquiring packages.
Inspect packages
package Foo -S Signals
; load
skill private-feeds
for authenticated/custom sources.
Inspect libraries
library Foo
or
library path/to.dll
; load
skill metadata
for raw ECMA-335 tables/heaps.
Relationships
depends Type
,
extensions Type
,
implements Interface
.
目标命令
查找API
find Pattern
包含平台/BCL类型;若要纳入项目引用范围,添加
--project path/to/project
参数。
检查类型
type Type --package Foo
;添加
--all
参数可查看非公共/隐藏成员。
检查重载
member Type --platform Lib -m Name -S "Member Index"
选择重载
member Type --platform Lib Name:1
Name~digest
对比API
diff --package Foo@old..new --breaking
--additive
用于查看新增API);
--alloc-regressions
用于查看性能退化情况(内存分配增加,按热度排序)。
追踪API演进
timeline --package Foo@old..new --type Type --members --at all
;省略
--at
参数可在不获取包的情况下查看演进脉络。
检查包
package Foo -S Signals
;加载
skill private-feeds
可访问经过身份验证的/自定义源。
检查库
library Foo
library path/to.dll
;加载
skill metadata
可查看原始ECMA-335表/堆。
关系查询
depends Type
extensions Type
implements Interface

Member lookup

成员查找

Run
find Name
when scope is unknown, inspect the type, then
-S "Member Index"
to list overloads. Select with
Name:N
(1-based) or
Name~digest
(stable). A selected overload defaults to
Signature
. A fully-qualified
Namespace.Type.Member
needs no scope.
bash
dnx dotnet-inspect -y -- find JsonSerializer
dnx dotnet-inspect -y -- member JsonSerializer --platform System.Text.Json -m Serialize -S "Member Index"
dnx dotnet-inspect -y -- member JsonSerializer --platform System.Text.Json Serialize:1 -S Signature
dnx dotnet-inspect -y -- member System.Text.Json.JsonSerializer.Serialize -S "Member Index"
当范围未知时,运行
find Name
,检查类型后,使用
-S "Member Index"
列出重载。通过
Name:N
(从1开始计数)或
Name~digest
(稳定标识)选择重载。选中的重载默认显示
Signature
。完全限定的
Namespace.Type.Member
无需指定范围。
bash
dnx dotnet-inspect -y -- find JsonSerializer
dnx dotnet-inspect -y -- member JsonSerializer --platform System.Text.Json -m Serialize -S "Member Index"
dnx dotnet-inspect -y -- member JsonSerializer --platform System.Text.Json Serialize:1 -S Signature
dnx dotnet-inspect -y -- member System.Text.Json.JsonSerializer.Serialize -S "Member Index"

Tips

提示

  • Default output is Markdown; for formats,
    -D
    /
    -S
    discovery, projection, and limits, load
    dotnet-inspect skill query
    . Decompiled source uses readable synthesized local names when PDB names are unavailable.
  • Add
    --project <csproj|dir|project.assets.json>
    when project-referenced packages should be in scope; it reads existing restored assets, so restore/build first if dependencies changed.
  • Common BCL types resolve without scope:
    type string
    ,
    type 'List<T>'
    . Quote generics and patterns:
    member 'Dictionary<TKey,TValue>'
    ,
    -S "Async*"
    .
  • Unpinned packages use latest stable; add
    --preview
    for prerelease APIs.
  • 默认输出格式为Markdown;如需其他格式,可加载
    dotnet-inspect skill query
    来使用
    -D
    /
    -S
    进行发现、投影和限制。当PDB名称不可用时,反编译的源码会使用易读的合成局部变量名。
  • 若要将项目引用的包纳入范围,添加
    --project <csproj|dir|project.assets.json>
    参数;该参数会读取已还原的现有资产,因此如果依赖项发生变更,请先执行还原/构建操作。
  • 常见的BCL类型无需指定范围即可解析:
    type string
    type 'List<T>'
    。泛型和模式需要加引号:
    member 'Dictionary<TKey,TValue>'
    -S "Async*"
  • 未固定版本的包会使用最新稳定版;添加
    --preview
    参数可查看预发布API。