@cratis/pi 7.102.0 → 7.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +10 -1
- package/package/corpus/harnesses/copilot/instructions/pull-requests.instructions.md +2 -0
- package/package/corpus/harnesses/copilot/instructions/secrets.instructions.md +4 -0
- package/package/corpus/hooks/README.md +11 -1
- package/package/corpus/hooks/scripts/cratis-check-pr.mjs +12 -1
- package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +79 -23
- package/package/corpus/hooks/scripts/cratis-guard-writes.sh +145 -40
- package/package/corpus/rules/profiles.md +10 -1
- package/package/corpus/rules/pull-requests.md +2 -0
- package/package/corpus/rules/secrets.md +4 -0
- package/package/corpus/skills/analyzing-dotnet-performance/LICENSE +23 -0
- package/package/corpus/skills/analyzing-dotnet-performance/NOTICE +36 -0
- package/package/corpus/skills/analyzing-dotnet-performance/SKILL.md +214 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/async-patterns.md +122 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/collections-and-linq.md +220 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/critical-patterns.md +291 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/io-and-serialization.md +135 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/memory-and-strings.md +219 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/regex-patterns.md +95 -0
- package/package/corpus/skills/analyzing-dotnet-performance/references/structural-patterns.md +38 -0
- package/package/corpus/skills/binlog-generation/LICENSE +23 -0
- package/package/corpus/skills/binlog-generation/NOTICE +22 -0
- package/package/corpus/skills/binlog-generation/SKILL.md +129 -0
- package/package/corpus/skills/check-bin-obj-clash/LICENSE +23 -0
- package/package/corpus/skills/check-bin-obj-clash/NOTICE +27 -0
- package/package/corpus/skills/check-bin-obj-clash/SKILL.md +127 -0
- package/package/corpus/skills/check-bin-obj-clash/references/common-causes-and-fixes.md +206 -0
- package/package/corpus/skills/coverage-analysis/LICENSE +23 -0
- package/package/corpus/skills/coverage-analysis/NOTICE +32 -0
- package/package/corpus/skills/coverage-analysis/SKILL.md +198 -0
- package/package/corpus/skills/coverage-analysis/references/guidelines.md +68 -0
- package/package/corpus/skills/coverage-analysis/references/output-format.md +91 -0
- package/package/corpus/skills/coverage-analysis/references/report-generation.md +58 -0
- package/package/corpus/skills/coverage-analysis/references/setup-discovery.md +307 -0
- package/package/corpus/skills/coverage-analysis/scripts/Compute-CrapScores.ps1 +80 -0
- package/package/corpus/skills/coverage-analysis/scripts/CoverageData.ps1 +272 -0
- package/package/corpus/skills/coverage-analysis/scripts/Extract-MethodCoverage.ps1 +65 -0
- package/package/corpus/skills/csharp-refactoring/LICENSE +23 -0
- package/package/corpus/skills/csharp-refactoring/NOTICE +22 -0
- package/package/corpus/skills/csharp-refactoring/SKILL.md +175 -0
- package/package/corpus/skills/csharp-refactoring/references/operation-catalog.md +37 -0
- package/package/corpus/skills/directory-build-organization/LICENSE +23 -0
- package/package/corpus/skills/directory-build-organization/NOTICE +21 -0
- package/package/corpus/skills/directory-build-organization/SKILL.md +205 -0
- package/package/corpus/skills/directory-build-organization/references/common-patterns.md +56 -0
- package/package/corpus/skills/directory-build-organization/references/multi-level-examples.md +167 -0
- package/package/corpus/skills/directory-build-organization/references/targetframework-props-pitfall.md +54 -0
- package/package/corpus/skills/dotnet-aot-compat/LICENSE +23 -0
- package/package/corpus/skills/dotnet-aot-compat/NOTICE +18 -0
- package/package/corpus/skills/dotnet-aot-compat/SKILL.md +265 -0
- package/package/corpus/skills/dotnet-aot-compat/references/polyfills.md +43 -0
- package/package/corpus/skills/dotnet-trace-collect/LICENSE +23 -0
- package/package/corpus/skills/dotnet-trace-collect/NOTICE +65 -0
- package/package/corpus/skills/dotnet-trace-collect/SKILL.md +116 -0
- package/package/corpus/skills/dotnet-trace-collect/references/dotnet-monitor.md +97 -0
- package/package/corpus/skills/dotnet-trace-collect/references/dotnet-trace-collect-linux.md +84 -0
- package/package/corpus/skills/dotnet-trace-collect/references/dotnet-trace-collect.md +91 -0
- package/package/corpus/skills/dotnet-trace-collect/references/perfcollect.md +200 -0
- package/package/corpus/skills/dotnet-trace-collect/references/perfview.md +141 -0
- package/package/corpus/skills/dotnet-trace-collect/references/tool-selection.md +160 -0
- package/package/corpus/skills/dump-collect/LICENSE +23 -0
- package/package/corpus/skills/dump-collect/NOTICE +40 -0
- package/package/corpus/skills/dump-collect/SKILL.md +97 -0
- package/package/corpus/skills/dump-collect/references/container-dumps.md +412 -0
- package/package/corpus/skills/dump-collect/references/coreclr-dumps.md +108 -0
- package/package/corpus/skills/dump-collect/references/nativeaot-dumps.md +280 -0
- package/package/corpus/skills/eliminate-redundant-restores/LICENSE +23 -0
- package/package/corpus/skills/eliminate-redundant-restores/NOTICE +19 -0
- package/package/corpus/skills/eliminate-redundant-restores/SKILL.md +112 -0
- package/package/corpus/skills/extension-points/LICENSE +23 -0
- package/package/corpus/skills/extension-points/NOTICE +18 -0
- package/package/corpus/skills/extension-points/SKILL.md +248 -0
- package/package/corpus/skills/filter-syntax/LICENSE +23 -0
- package/package/corpus/skills/filter-syntax/NOTICE +17 -0
- package/package/corpus/skills/filter-syntax/SKILL.md +179 -0
- package/package/corpus/skills/including-generated-files/LICENSE +23 -0
- package/package/corpus/skills/including-generated-files/NOTICE +17 -0
- package/package/corpus/skills/including-generated-files/SKILL.md +139 -0
- package/package/corpus/skills/microbenchmarking/LICENSE +23 -0
- package/package/corpus/skills/microbenchmarking/NOTICE +36 -0
- package/package/corpus/skills/microbenchmarking/SKILL.md +131 -0
- package/package/corpus/skills/microbenchmarking/references/bdn-internals-and-tuning.md +143 -0
- package/package/corpus/skills/microbenchmarking/references/comparison-strategies.md +200 -0
- package/package/corpus/skills/microbenchmarking/references/diagnosers-and-exporters.md +150 -0
- package/package/corpus/skills/microbenchmarking/references/project-setup-and-running.md +189 -0
- package/package/corpus/skills/microbenchmarking/references/writing-benchmarks.md +310 -0
- package/package/corpus/skills/msbuild/LICENSE +23 -0
- package/package/corpus/skills/msbuild/NOTICE +55 -0
- package/package/corpus/skills/msbuild/SKILL.md +117 -0
- package/package/corpus/skills/msbuild/references/antipatterns/additional-antipatterns.md +291 -0
- package/package/corpus/skills/msbuild/references/antipatterns/incremental-build-inputs-outputs.md +57 -0
- package/package/corpus/skills/msbuild/references/antipatterns/private-assets.md +29 -0
- package/package/corpus/skills/msbuild/references/binlog-failure-analysis.md +85 -0
- package/package/corpus/skills/msbuild/references/binlog-generation.md +69 -0
- package/package/corpus/skills/msbuild/references/build-perf-baseline.md +493 -0
- package/package/corpus/skills/msbuild/references/build-perf-diagnostics.md +268 -0
- package/package/corpus/skills/msbuild/references/copy-to-output-directory.md +183 -0
- package/package/corpus/skills/msbuild/references/eval-performance.md +190 -0
- package/package/corpus/skills/msbuild/references/extension-points.md +281 -0
- package/package/corpus/skills/msbuild/references/incremental-build.md +365 -0
- package/package/corpus/skills/msbuild/references/msbuild-antipatterns.md +401 -0
- package/package/corpus/skills/orleans/LICENSE +21 -0
- package/package/corpus/skills/orleans/NOTICE +64 -0
- package/package/corpus/skills/orleans/SKILL.md +140 -0
- package/package/corpus/skills/orleans/references/anti-patterns.md +660 -0
- package/package/corpus/skills/orleans/references/configuration-api.md +933 -0
- package/package/corpus/skills/orleans/references/examples.md +66 -0
- package/package/corpus/skills/orleans/references/grain-api.md +784 -0
- package/package/corpus/skills/orleans/references/grains.md +75 -0
- package/package/corpus/skills/orleans/references/hosting.md +71 -0
- package/package/corpus/skills/orleans/references/implementation.md +591 -0
- package/package/corpus/skills/orleans/references/official-docs-index.md +250 -0
- package/package/corpus/skills/orleans/references/patterns.md +811 -0
- package/package/corpus/skills/orleans/references/persistence-api.md +495 -0
- package/package/corpus/skills/orleans/references/primitive-selection.md +35 -0
- package/package/corpus/skills/orleans/references/scheduling-and-services.md +295 -0
- package/package/corpus/skills/orleans/references/serialization-api.md +299 -0
- package/package/corpus/skills/orleans/references/streaming-api.md +396 -0
- package/package/corpus/skills/orleans/references/testing-patterns.md +210 -0
- package/package/corpus/skills/platform-detection/LICENSE +23 -0
- package/package/corpus/skills/platform-detection/NOTICE +17 -0
- package/package/corpus/skills/platform-detection/SKILL.md +230 -0
- package/package/corpus/skills/platform-detection/references/command-mode.md +27 -0
- package/package/corpus/skills/profiling/LICENSE +21 -0
- package/package/corpus/skills/profiling/NOTICE +50 -0
- package/package/corpus/skills/profiling/SKILL.md +144 -0
- package/package/corpus/skills/profiling/references/commands.md +439 -0
- package/package/corpus/skills/profiling/references/patterns.md +586 -0
- package/package/corpus/skills/profiling/references/profiling.md +190 -0
- package/package/corpus/skills/run-tests/LICENSE +23 -0
- package/package/corpus/skills/run-tests/NOTICE +19 -0
- package/package/corpus/skills/run-tests/SKILL.md +305 -0
- package/package/corpus/skills/target-authoring/LICENSE +23 -0
- package/package/corpus/skills/target-authoring/NOTICE +17 -0
- package/package/corpus/skills/target-authoring/SKILL.md +165 -0
- package/package/corpus/skills/vectorization/LICENSE +23 -0
- package/package/corpus/skills/vectorization/NOTICE +17 -0
- package/package/corpus/skills/vectorization/SKILL.md +189 -0
- package/package/profile-catalog.json +85 -1
- package/package.json +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Official .NET Profiling Tools
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- What This Skill Uses
|
|
6
|
+
- Installation Paths
|
|
7
|
+
- Release-First Rule
|
|
8
|
+
- First-Line Live Triage with dotnet-counters
|
|
9
|
+
- CPU and Runtime Tracing with dotnet-trace
|
|
10
|
+
- Exceptions, Contention, and JIT Clues
|
|
11
|
+
- Heap Investigation with dotnet-gcdump
|
|
12
|
+
- Practical Investigation Order
|
|
13
|
+
- Useful Guardrails
|
|
14
|
+
|
|
15
|
+
## What This Skill Uses
|
|
16
|
+
|
|
17
|
+
This skill standardizes on official CLI-based .NET diagnostics tools:
|
|
18
|
+
|
|
19
|
+
- `dotnet-counters` for live metrics and exported counters
|
|
20
|
+
- `dotnet-trace` for trace capture and hotspot investigation
|
|
21
|
+
- `dotnet-gcdump` for managed heap snapshots
|
|
22
|
+
|
|
23
|
+
It intentionally avoids `dnx`-only flows so the commands remain explicit and durable in repo docs.
|
|
24
|
+
|
|
25
|
+
## Installation Paths
|
|
26
|
+
|
|
27
|
+
Preferred install path for frequent local diagnostics:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Cratis: Downloads or installs a tool: requires the user's approval; prefer a pinned version (`dotnet tool install <tool> --version <x>`)
|
|
31
|
+
dotnet tool install --global dotnet-counters --version <x>
|
|
32
|
+
# Cratis: Downloads or installs a tool: requires the user's approval; prefer a pinned version (`dotnet tool install <tool> --version <x>`)
|
|
33
|
+
dotnet tool install --global dotnet-trace --version <x>
|
|
34
|
+
# Cratis: Downloads or installs a tool: requires the user's approval; prefer a pinned version (`dotnet tool install <tool> --version <x>`)
|
|
35
|
+
dotnet tool install --global dotnet-gcdump --version <x>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Verify the tools:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
dotnet-counters --version
|
|
42
|
+
dotnet-trace --version
|
|
43
|
+
dotnet-gcdump --version
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If global tools are not suitable, use the official Microsoft Learn direct-download links for each tool:
|
|
47
|
+
|
|
48
|
+
- `dotnet-counters`
|
|
49
|
+
- `dotnet-trace`
|
|
50
|
+
- `dotnet-gcdump`
|
|
51
|
+
|
|
52
|
+
## Release-First Rule
|
|
53
|
+
|
|
54
|
+
Profile realistic builds and realistic scenarios:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
dotnet build -c Release
|
|
58
|
+
dotnet run -c Release --project ./src/MyApp/MyApp.csproj
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Avoid profiling Debug builds unless the debugging overhead itself is the question.
|
|
62
|
+
|
|
63
|
+
## First-Line Live Triage with dotnet-counters
|
|
64
|
+
|
|
65
|
+
Use `dotnet-counters` first when you need fast feedback about:
|
|
66
|
+
|
|
67
|
+
- CPU usage
|
|
68
|
+
- GC activity
|
|
69
|
+
- allocation growth
|
|
70
|
+
- exception rate
|
|
71
|
+
- working set
|
|
72
|
+
- thread pool pressure
|
|
73
|
+
|
|
74
|
+
List candidate processes:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
dotnet-counters ps
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Monitor runtime counters:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
dotnet-counters monitor --process-id PID --counters System.Runtime
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Export counters for later comparison:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
dotnet-counters collect --process-id PID --counters System.Runtime --format json -o counters.json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For startup diagnostics:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
dotnet-counters monitor --counters System.Runtime -- dotnet exec ./bin/Release/net10.0/MyApp.dll
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## CPU and Runtime Tracing with dotnet-trace
|
|
99
|
+
|
|
100
|
+
Use `dotnet-trace` when counters show that deeper investigation is needed.
|
|
101
|
+
|
|
102
|
+
List candidate processes:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
dotnet-trace ps
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Capture a focused general-purpose trace:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
dotnet-trace collect --process-id PID --profile dotnet-common,dotnet-sampled-thread-time -o trace.nettrace
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Capture GC-heavy detail:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
dotnet-trace collect --process-id PID --profile gc-verbose -o gc.nettrace
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Trace startup directly:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
dotnet-trace collect -- dotnet exec ./bin/Release/net10.0/MyApp.dll
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Get a top-method summary from a captured trace:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
dotnet-trace report trace.nettrace topN --number 20
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Convert for external viewers when needed:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
dotnet-trace convert trace.nettrace --format Speedscope
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Exceptions, Contention, and JIT Clues
|
|
139
|
+
|
|
140
|
+
`dotnet-trace` is the main CLI path when you need:
|
|
141
|
+
|
|
142
|
+
- exception-heavy traces
|
|
143
|
+
- contention signals
|
|
144
|
+
- JIT and runtime event visibility
|
|
145
|
+
|
|
146
|
+
Keep the run focused and compare the same scenario before and after each fix.
|
|
147
|
+
|
|
148
|
+
## Heap Investigation with dotnet-gcdump
|
|
149
|
+
|
|
150
|
+
Use `dotnet-gcdump` when you need managed heap composition rather than CPU stacks.
|
|
151
|
+
|
|
152
|
+
List candidate processes:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
dotnet-gcdump ps
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Capture a heap snapshot:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
dotnet-gcdump collect --process-id PID --output heap.gcdump
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Get a heap summary report:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
dotnet-gcdump report heap.gcdump
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Important warning:
|
|
171
|
+
|
|
172
|
+
- `dotnet-gcdump collect` triggers a full Gen 2 GC
|
|
173
|
+
- this can pause the target process for a long time on large heaps
|
|
174
|
+
- do not use it casually on latency-sensitive production paths
|
|
175
|
+
|
|
176
|
+
## Practical Investigation Order
|
|
177
|
+
|
|
178
|
+
1. Reproduce the issue in a realistic `Release` scenario.
|
|
179
|
+
2. Start with `dotnet-counters monitor`.
|
|
180
|
+
3. If the symptom is CPU or startup related, capture `dotnet-trace`.
|
|
181
|
+
4. If the symptom is memory-shape related, capture `dotnet-gcdump`.
|
|
182
|
+
5. Apply one fix at a time.
|
|
183
|
+
6. Rerun the same command set and compare.
|
|
184
|
+
|
|
185
|
+
## Useful Guardrails
|
|
186
|
+
|
|
187
|
+
- use the same user as the target process, or root where required
|
|
188
|
+
- on Linux and macOS, the tool and target process may need the same `TMPDIR`
|
|
189
|
+
- prefer `dotnet exec` or direct app launch over `dotnet run` for startup tracing, because `dotnet run` may spawn extra child processes
|
|
190
|
+
- keep artifacts named and stored predictably so comparisons are easy
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) .NET Foundation and Contributors
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Run .NET Tests
|
|
2
|
+
Copyright (c) .NET Foundation and Contributors
|
|
3
|
+
Licensed under the MIT License. See LICENSE.
|
|
4
|
+
|
|
5
|
+
Upstream source: https://github.com/dotnet/skills/blob/a6bf43ab61967c30919334986515163ab24d7635/plugins/dotnet-test/skills/run-tests/SKILL.md
|
|
6
|
+
|
|
7
|
+
Changes made by Cratis:
|
|
8
|
+
|
|
9
|
+
LICENSE:
|
|
10
|
+
- Copy upstream MIT license and copyright verbatim.
|
|
11
|
+
|
|
12
|
+
SKILL.md:
|
|
13
|
+
- Normalize frontmatter serialization, add MIT license where absent; preserve name and description.
|
|
14
|
+
- Add marked modification/source comment and applicability/Cratis precedence line with the skill-specific safety, ownership or compatibility caveat.
|
|
15
|
+
- Render unimported mtp-hot-reload routing reference as plain topic text.
|
|
16
|
+
- Rewrite the description to the Cratis shape (what it does, Use when, Not for) and drop references to skills that are not part of this corpus.
|
|
17
|
+
- Remove the reference to the mtp-hot-reload skill.
|
|
18
|
+
|
|
19
|
+
NOTICE: Add this attribution, change list, and any download/execution disclosure.
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: run-tests
|
|
3
|
+
description: 'Chooses and runs the repository-compatible .NET test command: classic, VSTest, bridged MTP, or native MTP syntax for MSTest, xUnit, NUnit, and TUnit. Use before running .NET tests or answering with a test command or flags: run the tests, one test, class, category, trait or target framework, combined filters, --filter-query, --no-build, --diag, TRX, coverage collection, crash or hang dumps, filter errors, or unrecognized options. Not for platform identification alone (use platform-detection), writing or debugging test code, interpreting a coverage report (use coverage-analysis), CI investigation, migration, or a persistent hot-reload loop.'
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
portability: portable
|
|
7
|
+
binding: optional-overlay
|
|
8
|
+
binding-revision: '1'
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<!-- Modified by Cratis from dotnet's original (MIT): frontmatter, applicability, navigation and the changes listed in NOTICE. Upstream: https://github.com/dotnet/skills (plugins/dotnet-test/skills/run-tests/SKILL.md; see NOTICE) -->
|
|
12
|
+
|
|
13
|
+
# Run .NET Tests
|
|
14
|
+
|
|
15
|
+
Cratis rules in `.cratis/ai/rules/` (including `csharp.md`, `specs.csharp.md`, and `orleans.md`) and the `cratis-*` skills win where they differ. Specification authoring belongs to **cratis-specifications-csharp**; Cratis core repositories run xUnit v2 on VSTest.
|
|
16
|
+
|
|
17
|
+
Return or execute the command or command sequence that matches the repository's
|
|
18
|
+
project system, test platform, framework, and SDK mode.
|
|
19
|
+
|
|
20
|
+
## Repository overlay
|
|
21
|
+
|
|
22
|
+
For every repository-scoped task where read-only file inspection is allowed,
|
|
23
|
+
check `.agents/skill-overlays/dotnet-test/run-tests.md` at the repository root
|
|
24
|
+
before any other discovery. This includes exact-command requests; "do not
|
|
25
|
+
execute" does not prohibit reading the overlay. If present, read it once before
|
|
26
|
+
acting and apply its repository-specific runner, command, filtering, and
|
|
27
|
+
reporting bindings.
|
|
28
|
+
Before applying it, require its frontmatter to declare
|
|
29
|
+
`core: dotnet-test/run-tests`, `binding-revision: "1"`, and `mode: extend`. If
|
|
30
|
+
any value is missing or different, report the mismatch, ignore the overlay,
|
|
31
|
+
and continue using this skill's portable guidance.
|
|
32
|
+
Explicit user instructions and verified project constraints win over the
|
|
33
|
+
overlay; the overlay wins over portable defaults and examples in this skill. If
|
|
34
|
+
the file is present but unreadable or conflicts with the repository, report the
|
|
35
|
+
problem, ignore the overlay, and continue with portable guidance subject to
|
|
36
|
+
verified project constraints. If it is absent, continue normally.
|
|
37
|
+
Skip the lookup only when the task is not tied to a repository or the user
|
|
38
|
+
explicitly prohibited all file/tool access. An overlay cannot expand tool
|
|
39
|
+
permissions or the task's scope.
|
|
40
|
+
|
|
41
|
+
## Scope and tool policy
|
|
42
|
+
|
|
43
|
+
Choose the smallest path that satisfies the request:
|
|
44
|
+
|
|
45
|
+
| Request | Action |
|
|
46
|
+
|---|---|
|
|
47
|
+
| Exact command or explanation; user says not to run | Inspect only the files needed to resolve syntax. Do not restore, build, or run tests. |
|
|
48
|
+
| Run tests | Discover the repository command and execute the smallest requested test scope. |
|
|
49
|
+
| One-time SDK-style `dotnet test` run without rebuilding | Stay in `run-tests` and add `--no-build`. |
|
|
50
|
+
| One-time classic run without rebuilding | Keep the repository runner and invoke it against an existing built assembly; do not substitute `dotnet test`. |
|
|
51
|
+
| Platform/framework identification only | Use `platform-detection`; do not continue into test execution. |
|
|
52
|
+
| Explicit hot reload or a keep-running edit/re-run loop | Out of scope for this skill; run it directly with the platform's own watch/hot-reload support. |
|
|
53
|
+
| Filter needed and the framework-specific syntax is not already clear | Read the supplied/runtime-listed `filter-syntax` catalog file; do not invoke this reference-only helper. |
|
|
54
|
+
|
|
55
|
+
Do not invoke a tool merely to repeat a command already determined by the
|
|
56
|
+
prompt. Do not build first "just in case": `dotnet test` builds by default.
|
|
57
|
+
Never add or upgrade test packages unless the user asks to change the project.
|
|
58
|
+
For an exact-command request, return one runnable command first. Do not emit
|
|
59
|
+
placeholder paths, exploratory alternatives, or a correction sequence. Use a
|
|
60
|
+
project path only when the prompt or repository establishes it; otherwise let
|
|
61
|
+
the command operate on the current project or solution when that syntax is
|
|
62
|
+
valid. Follow it with only the syntax fact needed to explain the command; do
|
|
63
|
+
not volunteer platform/command-mode taxonomy unless the user asked for it. In
|
|
64
|
+
particular, do not label an SDK 8/9 bridge as "VSTest platform" merely because
|
|
65
|
+
`dotnet test` uses its VSTest command mode; the executed platform is MTP. For a
|
|
66
|
+
command-only request, it is normally clearer to say only that MTP application
|
|
67
|
+
arguments must follow `--`.
|
|
68
|
+
|
|
69
|
+
## Inputs to discover
|
|
70
|
+
|
|
71
|
+
- Project, solution, module, or repository test command
|
|
72
|
+
- Requested scope: all tests, TFM, class, method, category, or trait
|
|
73
|
+
- Requested output: console result, TRX, diagnostics, crash dump, or hang dump
|
|
74
|
+
|
|
75
|
+
When those facts are present in the prompt, use them. Otherwise inspect only the
|
|
76
|
+
relevant files: `global.json`, the selected project, `packages.config`,
|
|
77
|
+
`Directory.Build.props`, `Directory.Packages.props`, then repository
|
|
78
|
+
scripts/CI documentation. For a file-backed request, enumerate those
|
|
79
|
+
configuration names once and read all relevant files that are present in one
|
|
80
|
+
batch; never infer that a runner or bridge property is absent merely because it
|
|
81
|
+
is not in the `.csproj`. Load `platform-detection` only when those signals need
|
|
82
|
+
precedence analysis; do not duplicate its full analysis in the response.
|
|
83
|
+
If execution is requested and the command depends on the active SDK but neither
|
|
84
|
+
the prompt nor `global.json` establishes it, run `dotnet --version` once. For a
|
|
85
|
+
command-only request that prohibits execution, do not probe: state the required
|
|
86
|
+
SDK assumption or ask for the SDK version when the syntax cannot otherwise be
|
|
87
|
+
resolved. Route identification-only requests to `platform-detection`.
|
|
88
|
+
|
|
89
|
+
## Decision table
|
|
90
|
+
|
|
91
|
+
| Detected mode / platform | Command shape | Never use |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| Classic non-SDK | Repository script, or full MSBuild followed by `vstest.console.exe` / `MSTest.exe` | Assuming `dotnet test` is compatible or migrating implicitly |
|
|
94
|
+
| VSTest mode / VSTest | `dotnet test [<path>] [VSTEST_OPTIONS]` | MTP-only flags such as `--report-trx` or `--treenode-filter` |
|
|
95
|
+
| VSTest mode / executable MTP bridge | `dotnet test [<path>] [DOTNET_OPTIONS] -- [MTP_OPTIONS]` | Omitting the `--` separator, including on SDK 10 |
|
|
96
|
+
| Native MTP mode, SDK 10+ | `dotnet test --project <path> [DOTNET_OPTIONS] [MTP_OPTIONS]` | Bare positional project paths or the bridge separator |
|
|
97
|
+
|
|
98
|
+
`global.json` controls the `dotnet test` command mode on SDK 10+, not
|
|
99
|
+
necessarily the platform that executes tests. A VSTest-mode project with an MTP
|
|
100
|
+
runner, `TestingPlatformDotnetTestSupport=true`, and final `OutputType=Exe` is
|
|
101
|
+
still bridge syntax with `--`. SDK 8/9 only has VSTest command mode.
|
|
102
|
+
|
|
103
|
+
`--project` is valid only in SDK 10+ **native MTP command mode** (selected by
|
|
104
|
+
`global.json` `test.runner`). Never use it for VSTest mode or an SDK 8/9 bridge;
|
|
105
|
+
those forms take a positional project path. Conversely, native MTP options are
|
|
106
|
+
direct arguments and must not be placed after a bridge separator.
|
|
107
|
+
|
|
108
|
+
Keep `dotnet test`/MSBuild options such as `--framework`, `--configuration`,
|
|
109
|
+
`--no-build`, and `--verbosity` before `--`. Put only MTP application arguments
|
|
110
|
+
after `--` in bridge mode.
|
|
111
|
+
|
|
112
|
+
## Workflow
|
|
113
|
+
|
|
114
|
+
1. **Resolve the repository-compatible runner.**
|
|
115
|
+
|
|
116
|
+
For classic projects, signals include `ToolsVersion`, explicit `Compile` and
|
|
117
|
+
`Reference` items, legacy imports, and `packages.config`. Prefer a checked-in
|
|
118
|
+
script or documented CI command. A typical fallback is:
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
nuget restore MySolution.sln
|
|
122
|
+
MSBuild.exe MySolution.sln /t:Build /p:Configuration=Debug
|
|
123
|
+
vstest.console.exe path\to\MyTests.dll /TestAdapterPath:path\to\adapter\build\<tfm>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
For `packages.config`, restore with NuGet before the build unless the imported
|
|
127
|
+
package files are already present. If adapter discovery is not repository-
|
|
128
|
+
configured, derive `/TestAdapterPath` from the restored adapter package path or
|
|
129
|
+
the adapter `.props`/`.targets` imports; do not guess the package root.
|
|
130
|
+
|
|
131
|
+
For a requested no-rebuild run, omit the build step and invoke the repository's
|
|
132
|
+
test runner only when the expected assembly already exists. Otherwise report the
|
|
133
|
+
missing build output rather than silently rebuilding or switching runners.
|
|
134
|
+
|
|
135
|
+
For a requested subset, keep the repository runner and use its filter syntax:
|
|
136
|
+
`vstest.console.exe path\to\MyTests.dll
|
|
137
|
+
/TestCaseFilter:"TestCategory=Integration"`. Older `MSTest.exe` repositories may
|
|
138
|
+
use `/test:<name>` or `/category:<category>` instead. Do not substitute the
|
|
139
|
+
later `dotnet test` filter examples for a classic runner.
|
|
140
|
+
|
|
141
|
+
Use the installed adapter-compatible VSTest/MSTest toolchain. If it is not
|
|
142
|
+
available, state the missing prerequisite and the documented command; do not
|
|
143
|
+
claim tests ran.
|
|
144
|
+
Classic `packages.config` fallback commands are Windows toolchain commands.
|
|
145
|
+
Explicitly say they require a Windows Developer Command Prompt (or the
|
|
146
|
+
repository's equivalent configured environment) when the current host cannot
|
|
147
|
+
provide `nuget`, full MSBuild, and `vstest.console.exe`.
|
|
148
|
+
|
|
149
|
+
For SDK-style projects, distinguish:
|
|
150
|
+
|
|
151
|
+
| Signal | Meaning |
|
|
152
|
+
|---|---|
|
|
153
|
+
| SDK 10+ `global.json` selects `Microsoft.Testing.Platform` | Native MTP command mode |
|
|
154
|
+
| VSTest mode + enabled MTP runner + final `TestingPlatformDotnetTestSupport=true` + final `OutputType=Exe` | Executable VSTest-to-MTP bridge |
|
|
155
|
+
| VSTest mode without a complete runner-and-bridge combination | VSTest |
|
|
156
|
+
| `Microsoft.NET.Test.Sdk` plus adapter, without stronger MTP signals | VSTest |
|
|
157
|
+
| `TUnit` | MTP-only; use a configured bridge/native mode or the test executable |
|
|
158
|
+
|
|
159
|
+
Evaluate properties from the project and imported
|
|
160
|
+
`Directory.Build.props`/`Directory.Packages.props`. Respect project-level
|
|
161
|
+
overrides and per-target-framework conditions. A runner and bridge without an
|
|
162
|
+
executable final output are an incomplete MTP configuration, not a usable
|
|
163
|
+
bridge.
|
|
164
|
+
|
|
165
|
+
2. **Select the command and requested scope.**
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
# VSTest mode
|
|
169
|
+
dotnet test path/to/Tests.csproj
|
|
170
|
+
|
|
171
|
+
# VSTest mode that bridges to MTP
|
|
172
|
+
dotnet test path/to/Tests.csproj -- <MTP_OPTIONS>
|
|
173
|
+
|
|
174
|
+
# Native MTP mode on SDK 10+
|
|
175
|
+
dotnet test --project path/to/Tests.csproj <MTP_OPTIONS>
|
|
176
|
+
|
|
177
|
+
# One target framework; this stays before the bridge separator
|
|
178
|
+
dotnet test path/to/Tests.csproj --framework net9.0 -- <MTP_OPTIONS>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
For native MTP, use `--project`, `--solution`, or `--test-modules`; positional
|
|
182
|
+
paths belong to VSTest mode.
|
|
183
|
+
|
|
184
|
+
If the user names a subset, do not run the whole suite. Inspect test attributes
|
|
185
|
+
only when needed to translate a human label such as "integration" or "smoke"
|
|
186
|
+
into the framework's actual category/trait name.
|
|
187
|
+
|
|
188
|
+
When a VSTest class filter must distinguish similarly named classes, combine
|
|
189
|
+
the positive selector with an explicit negative selector rather than relying on
|
|
190
|
+
an incidental substring difference.
|
|
191
|
+
|
|
192
|
+
3. **Apply platform- and framework-correct filters.**
|
|
193
|
+
|
|
194
|
+
Read the supplied or runtime-listed `filter-syntax` file only when the request
|
|
195
|
+
is filtered and framework-specific syntax is unclear. It is reference-only,
|
|
196
|
+
not an invocable skill; otherwise use the common decisions below:
|
|
197
|
+
|
|
198
|
+
For a file-backed filtered request, resolve the framework and SDK command mode
|
|
199
|
+
from the project, `global.json`, and imported props before choosing syntax.
|
|
200
|
+
Do not infer VSTest syntax merely from `Microsoft.NET.Test.Sdk` or from the
|
|
201
|
+
framework name.
|
|
202
|
+
|
|
203
|
+
| Platform / framework | Filter |
|
|
204
|
+
|---|---|
|
|
205
|
+
| VSTest with MSTest, xUnit v2, or NUnit | `--filter "<property expression>"` |
|
|
206
|
+
| MTP with MSTest or NUnit | Same expression; after `--` in bridge mode, direct in native mode |
|
|
207
|
+
| MTP with xUnit v3 | `--filter-class`, `--filter-method`, `--filter-trait`, or one `--filter-query` for a combined expression |
|
|
208
|
+
| MTP with TUnit | `--treenode-filter` path expression |
|
|
209
|
+
|
|
210
|
+
Examples:
|
|
211
|
+
|
|
212
|
+
```shell
|
|
213
|
+
# VSTest MSTest/NUnit
|
|
214
|
+
dotnet test --filter "FullyQualifiedName~OrderServiceTests&TestCategory=Unit"
|
|
215
|
+
|
|
216
|
+
# SDK 8/9 or SDK 10 VSTest-mode MTP bridge, xUnit v3
|
|
217
|
+
dotnet test -- --filter-trait "Category=Integration"
|
|
218
|
+
|
|
219
|
+
# Native MTP, xUnit v3
|
|
220
|
+
dotnet test --project Tests.csproj --filter-class "*ShoppingCartTests*"
|
|
221
|
+
|
|
222
|
+
# One xUnit v3 combined expression
|
|
223
|
+
dotnet test -- --filter-query "/*/*/*Integration*/*[Category=Smoke]"
|
|
224
|
+
|
|
225
|
+
# TUnit on SDK 8/9 with a configured VSTest-to-MTP bridge
|
|
226
|
+
dotnet test -- --treenode-filter "/*/*/SmsNotificationTests/*"
|
|
227
|
+
|
|
228
|
+
# TUnit executable fallback when no bridge is configured
|
|
229
|
+
dotnet run --project Tests.csproj -- --treenode-filter "/*/*/SmsNotificationTests/*"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Do not use VSTest `--filter "ClassName=..."` with xUnit v3 on MTP. Do not use a
|
|
233
|
+
generic VSTest expression with TUnit.
|
|
234
|
+
When the user requests one combined xUnit query expression, return only one
|
|
235
|
+
`--filter-query` command; do not replace it with separate filter flags or offer
|
|
236
|
+
speculative alternative grammars.
|
|
237
|
+
|
|
238
|
+
4. **Add reports or diagnostics.**
|
|
239
|
+
|
|
240
|
+
| Outcome | VSTest | MTP |
|
|
241
|
+
|---|---|---|
|
|
242
|
+
| TRX | SDK-style: `--logger "trx;LogFileName=<name>.trx"` when an exact output file is requested, otherwise `--logger trx`; standalone `vstest.console.exe`: `/Logger:trx`; `MSTest.exe`: repository-documented results option | `--report-trx` |
|
|
243
|
+
| Results directory | `--results-directory <dir>` | `--results-directory <dir>` |
|
|
244
|
+
| Diagnostic log | `--diag <file>` | `--diagnostic --diagnostic-output-directory <dir>` |
|
|
245
|
+
| Crash dump | `--blame-crash` | `--crashdump` |
|
|
246
|
+
| Hang timeout | `--blame-hang --blame-hang-timeout 5min` | `--hangdump --hangdump-timeout 5min` |
|
|
247
|
+
| Code coverage | `--collect "Code Coverage"` | `--coverage` |
|
|
248
|
+
|
|
249
|
+
MTP report, dump, and coverage flags require their corresponding registered
|
|
250
|
+
extensions (`TrxReport`, `CrashDump`, `HangDump`, or `CodeCoverage`). Some
|
|
251
|
+
framework SDKs bundle common extensions; if a flag is unrecognized, inspect
|
|
252
|
+
package references before recommending a package change.
|
|
253
|
+
|
|
254
|
+
`--verbosity diagnostic` increases dotnet/MSBuild output verbosity; it does not
|
|
255
|
+
write a VSTest diagnostic log file.
|
|
256
|
+
|
|
257
|
+
Examples:
|
|
258
|
+
|
|
259
|
+
```shell
|
|
260
|
+
# VSTest TRX
|
|
261
|
+
dotnet test Tests.csproj --logger "trx;LogFileName=TestResults.trx"
|
|
262
|
+
|
|
263
|
+
# MTP bridge TRX
|
|
264
|
+
dotnet test Tests.csproj -- --report-trx
|
|
265
|
+
|
|
266
|
+
# Native MTP TRX and hang detection
|
|
267
|
+
dotnet test --project Tests.csproj --report-trx --hangdump --hangdump-timeout 5min
|
|
268
|
+
|
|
269
|
+
# Native MTP diagnostics
|
|
270
|
+
dotnet test --project Tests.csproj --diagnostic --diagnostic-output-directory artifacts/diagnostics
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
5. **Execute only when requested.**
|
|
274
|
+
|
|
275
|
+
Run the narrowest command or sequence that answers the request. Capture each
|
|
276
|
+
command, exit code, and test summary. A failed restore/build is not a test
|
|
277
|
+
failure, and a test failure is not a tool failure. Report which phase failed and
|
|
278
|
+
include the actionable diagnostic. Never claim a clean run unless the sequence
|
|
279
|
+
completed successfully with the intended tests executed.
|
|
280
|
+
For a filtered run, a successful exit is not enough: confirm the reported test
|
|
281
|
+
names or count match the requested scope. If the filter was ignored, correct the
|
|
282
|
+
platform-specific syntax and rerun before reporting success.
|
|
283
|
+
|
|
284
|
+
## Output contract
|
|
285
|
+
|
|
286
|
+
- Command-only request: lead with the exact command or command sequence, then
|
|
287
|
+
one short syntax explanation.
|
|
288
|
+
- Execution request: report the exact command or command sequence and
|
|
289
|
+
a literal `Passed: N, Failed: N, Skipped: N` summary from the completed run;
|
|
290
|
+
include the first actionable failure.
|
|
291
|
+
- Detection needed only to choose syntax: state the selected mode/platform
|
|
292
|
+
briefly, not a separate detection report.
|
|
293
|
+
- Missing prerequisite or incompatible configuration: name it explicitly and
|
|
294
|
+
stop rather than returning a success-shaped fallback.
|
|
295
|
+
|
|
296
|
+
## Validation
|
|
297
|
+
|
|
298
|
+
- The command matches classic, VSTest, bridged MTP, or native MTP mode.
|
|
299
|
+
- The framework-specific filter targets the requested subset.
|
|
300
|
+
- `--framework` and other `dotnet test` options are before any bridge separator.
|
|
301
|
+
- SDK 8/9 bridge commands contain `--`; `--project` appears only in SDK 10+
|
|
302
|
+
native MTP mode.
|
|
303
|
+
- TRX, diagnostics, dump, and coverage flags match the platform.
|
|
304
|
+
- No restore, build, or test was run for an advisory-only request.
|
|
305
|
+
- Reported results match the actual command outcome.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) .NET Foundation and Contributors
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Custom Target Authoring Patterns
|
|
2
|
+
Copyright (c) .NET Foundation and Contributors
|
|
3
|
+
Licensed under the MIT License. See LICENSE.
|
|
4
|
+
|
|
5
|
+
Upstream source: https://github.com/dotnet/skills/blob/a6bf43ab61967c30919334986515163ab24d7635/plugins/dotnet-msbuild/skills/target-authoring/SKILL.md
|
|
6
|
+
|
|
7
|
+
Changes made by Cratis:
|
|
8
|
+
|
|
9
|
+
LICENSE:
|
|
10
|
+
- Copy upstream MIT license and copyright verbatim.
|
|
11
|
+
|
|
12
|
+
SKILL.md:
|
|
13
|
+
- Normalize frontmatter serialization, add MIT license where absent; preserve name and description.
|
|
14
|
+
- Add marked modification/source comment and applicability/Cratis precedence line.
|
|
15
|
+
- Rewrite the description to the Cratis shape (what it does, Use when, Not for) and drop references to skills that are not part of this corpus.
|
|
16
|
+
|
|
17
|
+
NOTICE: Add this attribution, change list, and any download/execution disclosure.
|