@cratis/pi 7.182.1 → 7.183.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/skills/exp-mock-usage-analysis/LICENSE +23 -0
- package/package/corpus/skills/exp-mock-usage-analysis/NOTICE +21 -0
- package/package/corpus/skills/exp-mock-usage-analysis/SKILL.md +87 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/LICENSE +23 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/NOTICE +30 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/SKILL.md +97 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/aspnetcore-dotnet10to11.md +24 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/core-libraries-dotnet10to11.md +124 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/cryptography-dotnet10to11.md +38 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/csharp-compiler-dotnet10to11.md +165 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/efcore-dotnet10to11.md +94 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/runtime-jit-dotnet10to11.md +58 -0
- package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/sdk-msbuild-dotnet10to11.md +26 -0
- package/package/corpus/skills/pvanalyze/LICENSE +21 -0
- package/package/corpus/skills/pvanalyze/NOTICE +32 -0
- package/package/corpus/skills/pvanalyze/SKILL.md +54 -0
- package/package/corpus/skills/pvanalyze/assets/NuGet.Config +7 -0
- package/package/corpus/skills/pvanalyze/assets/dotnet-tools.json +13 -0
- package/package/corpus/skills/pvanalyze/references/commands.md +147 -0
- package/package/corpus/skills/pvanalyze/references/install.md +50 -0
- package/package/corpus/skills/pvanalyze/references/overview.md +41 -0
- package/package/profile-catalog.json +15 -2
- package/package.json +1 -1
|
@@ -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,21 @@
|
|
|
1
|
+
Mock Usage Analysis
|
|
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/c227688ed14de4467e3e45f95dc69a94e905e219/plugins/dotnet-experimental/skills/exp-mock-usage-analysis/SKILL.md
|
|
6
|
+
|
|
7
|
+
Changes made by Cratis:
|
|
8
|
+
|
|
9
|
+
LICENSE:
|
|
10
|
+
- Copy upstream MIT license and copyright verbatim.
|
|
11
|
+
|
|
12
|
+
SKILL.md:
|
|
13
|
+
- Rewrite the description to the Cratis routing shape; scope the skill to NSubstitute in Cratis.Specifications contexts and drop the Moq and FakeItEasy terminology.
|
|
14
|
+
- Replace the per-test-method analysis with the full Specification context chain: inherited Establish, concrete Because and should_ assertions.
|
|
15
|
+
- Treat Received and DidNotReceive as assertions, not stubbing, and accept side-effect-only specifications at external boundaries.
|
|
16
|
+
- Replace the duplicated-setup and fixture refactoring advice with scenario-local shared contexts; remove the advice to replace collaborators with real implementations except for framework types such as loggers and options.
|
|
17
|
+
- Add an NSubstitute example, a static-hypothesis caveat and a no-edit-without-request rule.
|
|
18
|
+
- Replace the reference to an absent sibling skill with cratis-specifications-csharp.
|
|
19
|
+
- Add the marked modification/source comment and Cratis precedence line.
|
|
20
|
+
|
|
21
|
+
Executes or downloads: none.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: exp-mock-usage-analysis
|
|
3
|
+
description: Use when auditing existing NSubstitute setups in C# specifications for unused, unreachable or over-configured substitutes. Not for writing new specifications, replacing a mocking library or measuring coverage.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Modified by Cratis from dotnet's original (MIT): frontmatter, applicability, Specification lifecycle, NSubstitute scope and the changes listed in NOTICE. Upstream: https://github.com/dotnet/skills (plugins/dotnet-experimental/skills/exp-mock-usage-analysis/SKILL.md; see NOTICE) -->
|
|
8
|
+
|
|
9
|
+
# Mock usage analysis
|
|
10
|
+
|
|
11
|
+
Cratis rules in `.cratis/ai/rules/` (including `specs.csharp.md`) and the `cratis-*` skills win where they differ. Use [cratis-specifications-csharp](../cratis-specifications-csharp/SKILL.md) for writing or restructuring specifications; this skill only audits setups that already exist.
|
|
12
|
+
|
|
13
|
+
Trace each NSubstitute setup through the production code's execution path to find setups that no scenario exercises. A review request is not authority to edit or run anything: report findings, and edit only when asked.
|
|
14
|
+
|
|
15
|
+
## Inputs
|
|
16
|
+
|
|
17
|
+
| Input | Required | Description |
|
|
18
|
+
|-------|----------|-------------|
|
|
19
|
+
| Specification files | Yes | The contexts to audit, including every base context in the inheritance chain |
|
|
20
|
+
| Production code | Yes | The code under test; control flow cannot be traced without it |
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
### Step 1: Read the whole scenario
|
|
25
|
+
|
|
26
|
+
Read the concrete specification, every base context it inherits from (for example `given/all_dependencies.cs`) and the production code. A scenario is the context chain run base-first:
|
|
27
|
+
|
|
28
|
+
1. Each class's `Establish()` from the base context down.
|
|
29
|
+
2. The concrete class's single `Because()`.
|
|
30
|
+
3. Every `should_*` fact, which all share that one run.
|
|
31
|
+
|
|
32
|
+
### Step 2: Trace each setup per scenario
|
|
33
|
+
|
|
34
|
+
Identify every `Substitute.For<T>()`, `.Returns(...)`, `.Throws(...)` and `Arg` matcher. Follow the production method for the inputs `Because()` supplies and classify each setup:
|
|
35
|
+
|
|
36
|
+
| Classification | Meaning |
|
|
37
|
+
|----------------|---------|
|
|
38
|
+
| **Used** | `Because()` reaches the call, or an assertion reads the result |
|
|
39
|
+
| **Unreachable** | A guard, early return or throw leaves the method before the call in this scenario |
|
|
40
|
+
| **Unused** | The method under test never calls it for any input |
|
|
41
|
+
| **Duplicated** | The same setup repeats across scenarios; not a defect on its own |
|
|
42
|
+
|
|
43
|
+
Rules that prevent false findings:
|
|
44
|
+
|
|
45
|
+
- A setup in an inherited `Establish()` is used when any scenario that inherits it uses it. Unused by one `should_*` fact is not unused by the scenario, because every fact shares the setup that `Because()` runs through.
|
|
46
|
+
- Judge a setup against the scenarios that inherit it. A shared base context may be correct for most derived specs and unnecessary for one; report that distinction.
|
|
47
|
+
- `.Received()` and `.DidNotReceive()` are assertions, not stubbing. A specification that only asserts an interaction at an external boundary, such as a publisher, repository write or HTTP client, is valid even without a return-value assertion.
|
|
48
|
+
- Duplicated setup is not automatically redundant. Propose extraction only into a scenario-local shared base context that every duplicating scenario uses, never a global mutable fixture or an order-dependent setup.
|
|
49
|
+
- Look for early returns, guard clauses, exceptions thrown before a dependency is touched, and branches that dispatch to a different collaborator.
|
|
50
|
+
|
|
51
|
+
### Step 3: Check replaceable substitutes
|
|
52
|
+
|
|
53
|
+
- A substituted `ILogger<T>` can be `NullLogger<T>.Instance` unless the specification asserts log output.
|
|
54
|
+
- A substituted `IOptions<T>` can be `Options.Create(new T { ... })`.
|
|
55
|
+
- A substitute for a plain record or value object can be a real instance.
|
|
56
|
+
|
|
57
|
+
Keep substitutes at external boundaries (databases, HTTP clients, message queues, third-party APIs) and security-sensitive collaborators. Do not recommend replacing collaborators with concrete services in general.
|
|
58
|
+
|
|
59
|
+
### Step 4: Report
|
|
60
|
+
|
|
61
|
+
For each finding, give the specification and setup line, the scenario that makes it unnecessary and the production path that proves it, and the smallest removal or scenario-local change. Name correctly placed boundary substitutes explicitly. Mark every finding a static hypothesis unless the selected specifications were actually run.
|
|
62
|
+
|
|
63
|
+
```csharp
|
|
64
|
+
// given/an_order_handler.cs: Establish is shared by all derived scenarios
|
|
65
|
+
void Establish() => _prices.GetPrice(Arg.Any<string>()).Returns(10m);
|
|
66
|
+
// when_handling_unknown_customer: Because returns at the customer guard before _prices is called,
|
|
67
|
+
// so this scenario never uses the stub. Sibling scenarios do; keep the base setup and report
|
|
68
|
+
// the one scenario that could stop inheriting it.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Validation
|
|
72
|
+
|
|
73
|
+
- [ ] The full context chain and the production code were read and traced.
|
|
74
|
+
- [ ] Each finding names a specific scenario and setup line and the path that proves it.
|
|
75
|
+
- [ ] No setup was flagged only because one assertion does not read it.
|
|
76
|
+
- [ ] `Received`/`DidNotReceive` usage and boundary substitutes were treated as valid.
|
|
77
|
+
- [ ] Findings are labeled static hypotheses unless specifications were run.
|
|
78
|
+
|
|
79
|
+
## Pitfalls
|
|
80
|
+
|
|
81
|
+
| Pitfall | Correction |
|
|
82
|
+
|---------|------------|
|
|
83
|
+
| Reading only the concrete spec file | Read inherited `Establish` contexts too |
|
|
84
|
+
| Flagging a base setup because one fact ignores it | Judge it by the whole scenario |
|
|
85
|
+
| Treating verify-only specifications as dead | `Received` at a boundary is a valid assertion |
|
|
86
|
+
| Deleting duplicated setup across scenarios | Extract only scenario-local shared contexts |
|
|
87
|
+
| Editing while reviewing | Report findings; edit only when asked |
|
|
@@ -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,30 @@
|
|
|
1
|
+
.NET 10 to .NET 11 Migration
|
|
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/c227688ed14de4467e3e45f95dc69a94e905e219/plugins/dotnet-upgrade/skills/migrate-dotnet10-to-dotnet11/SKILL.md
|
|
6
|
+
The references/ files come from the same directory at the same revision.
|
|
7
|
+
|
|
8
|
+
Changes made by Cratis:
|
|
9
|
+
|
|
10
|
+
LICENSE:
|
|
11
|
+
- Copy upstream MIT license and copyright verbatim.
|
|
12
|
+
|
|
13
|
+
SKILL.md:
|
|
14
|
+
- Rewrite the description to the Cratis routing shape.
|
|
15
|
+
- Replace the claim to resolve all breaking changes with a checklist role: confirm each change against the linked Microsoft compatibility page and report contradictions.
|
|
16
|
+
- Replace the ban on external documentation, the automatic commit per step, bin/obj deletion and the blanket upgrade of Microsoft packages to 11.x with the repository's approved SDK, package pins and CI gates.
|
|
17
|
+
- Distinguish the SDK and compiler version from the runtime target and keep net10.0 in multi-targeted libraries; defer C# feature adoption to csharp.md.
|
|
18
|
+
- Replace the preview-era SDK version example and Docker tag edits with approved-scope guidance.
|
|
19
|
+
- Move the per-change lists into the references and add conditional read pointers for every reference.
|
|
20
|
+
- Add the marked modification/source comment and Cratis precedence line.
|
|
21
|
+
|
|
22
|
+
references/*.md:
|
|
23
|
+
- Replace the preview-status note with a statement that the checklist is not the exhaustive release contract.
|
|
24
|
+
- Remove Preview N markers from headings and the Preview 3 section title.
|
|
25
|
+
- Remove GitHub pull request and issue links; keep Microsoft Learn links.
|
|
26
|
+
- csharp-compiler-dotnet10to11.md: point feature adoption to csharp.md.
|
|
27
|
+
- core-libraries-dotnet10to11.md: correct the BackgroundService entry (the host already stopped on failure; .NET 11 propagates the exception from RunAsync/StopAsync) and replace the catch-all fix with guidance on exit-code consumers.
|
|
28
|
+
- Add a Contents list to core-libraries-dotnet10to11.md, csharp-compiler-dotnet10to11.md and efcore-dotnet10to11.md.
|
|
29
|
+
|
|
30
|
+
Executes or downloads: none. The imported text contains Docker and SDK version examples that were rewritten as guidance; this import runs nothing.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migrate-dotnet10-to-dotnet11
|
|
3
|
+
description: Use when moving a .NET 10 project or solution to the .NET 11 SDK or adding a net11.0 target, or when a build or behavior change appears after that move. Not for new .NET 11 projects, other version upgrades or .NET Framework migrations.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Modified by Cratis from dotnet's original (MIT): frontmatter, scope, workflow and the changes listed in NOTICE. Upstream: https://github.com/dotnet/skills (plugins/dotnet-upgrade/skills/migrate-dotnet10-to-dotnet11/SKILL.md; see NOTICE) -->
|
|
8
|
+
|
|
9
|
+
# .NET 10 → .NET 11 migration
|
|
10
|
+
|
|
11
|
+
Cratis rules in `.cratis/ai/rules/` (including `csharp.md`) and the `cratis-*` skills win where they differ. This skill is a checklist of known breaking changes, not the exhaustive .NET 11 compatibility contract: confirm each change against the linked Microsoft compatibility page before teaching or applying a fix, and report contradictions instead of guessing.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
- Use for upgrading a repository's SDK, retargeting to `net11.0`, or diagnosing build errors and behavior changes after either.
|
|
16
|
+
- Do not use for greenfield projects, upgrades from .NET 9 or earlier, .NET Framework migrations, or cosmetic modernization unrelated to the upgrade.
|
|
17
|
+
- Distinguish the SDK and compiler version from the runtime target. A .NET 11 SDK (C# 15) can build `net10.0` targets; libraries that multi-target `net10.0;net11.0` keep both. Drop `net10.0` only when the repository's support policy says so.
|
|
18
|
+
- Follow the C# 14/15 feature guidance in [csharp.md](../../rules/csharp.md) instead of adopting language features here. In particular, no new public union types in libraries that also target `net10.0`, no `closed` on existing public types, and no runtime-async.
|
|
19
|
+
- Keep the repository's approved SDK pin (`global.json`) and package pins. With Central Package Management, change `Directory.Packages.props` only where the approved upgrade scope requires it.
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
| Input | Required | Description |
|
|
24
|
+
|-------|----------|-------------|
|
|
25
|
+
| Project or solution path | Yes | The `.csproj`, `.sln` or `.slnx` entry point to migrate |
|
|
26
|
+
| Build and test commands | No | The repository's gate commands; detect them from its guidance when not given |
|
|
27
|
+
| Technology areas | No | ASP.NET Core, EF Core, cryptography, containers; detect from SDK attributes and package references |
|
|
28
|
+
|
|
29
|
+
## Workflow
|
|
30
|
+
|
|
31
|
+
### Step 1: Assess
|
|
32
|
+
|
|
33
|
+
1. Find how the repository builds and tests, and which gates CI runs.
|
|
34
|
+
2. Run `dotnet --version` to confirm the approved SDK is installed. Stop and report if it is not; do not install one.
|
|
35
|
+
3. Identify the technology areas from the project:
|
|
36
|
+
- `Microsoft.NET.Sdk.Web` → ASP.NET Core; `Microsoft.EntityFrameworkCore.*` → EF Core.
|
|
37
|
+
- Cryptography, mTLS or macOS usage → cryptography reference.
|
|
38
|
+
- Compression, TAR or `NamedPipeClientStream` usage → core-libraries reference.
|
|
39
|
+
- `BackgroundService` usage → an exception from `ExecuteAsync` now makes `RunAsync`/`Run` throw, so the process exits non-zero (the host already stopped before).
|
|
40
|
+
- Dockerfiles, CI SDK versions, old hardware or NativeAOT → runtime and SDK references.
|
|
41
|
+
4. Establish a baseline with the repository's normal build on the current target, and record pre-existing warnings. Do not delete `bin`/`obj` unless the repository's guidance allows it.
|
|
42
|
+
|
|
43
|
+
### Step 2: Update targets within the approved scope
|
|
44
|
+
|
|
45
|
+
1. Where the upgrade scope includes the runtime target, add `net11.0` (`<TargetFrameworks>net10.0;net11.0</TargetFrameworks>` for libraries) or retarget applications. Keep `net10.0` in multi-targeted libraries.
|
|
46
|
+
2. Update Microsoft package versions only as far as the approved scope requires, in the existing central location.
|
|
47
|
+
3. Restore and build with the repository's commands. Capture all errors and warnings.
|
|
48
|
+
|
|
49
|
+
### Step 3: Resolve build errors
|
|
50
|
+
|
|
51
|
+
Read only the references that match the technology areas and the actual errors:
|
|
52
|
+
|
|
53
|
+
| Reference | Read when |
|
|
54
|
+
|-----------|-----------|
|
|
55
|
+
| [csharp-compiler-dotnet10to11.md](references/csharp-compiler-dotnet10to11.md) | A C# compiler error or warning appears after the SDK or target change |
|
|
56
|
+
| [core-libraries-dotnet10to11.md](references/core-libraries-dotnet10to11.md) | Code uses compression, TAR, `MemoryStream`, `NamedPipeClientStream`, `BackgroundService`, `Environment.TickCount` or the Japanese calendar |
|
|
57
|
+
| [sdk-msbuild-dotnet10to11.md](references/sdk-msbuild-dotnet10to11.md) | A restore, publish, pack or MSBuild warning appears, or CI and SDK settings change |
|
|
58
|
+
| [aspnetcore-dotnet10to11.md](references/aspnetcore-dotnet10to11.md) | The project uses ASP.NET Core OpenAPI or Blazor |
|
|
59
|
+
| [efcore-dotnet10to11.md](references/efcore-dotnet10to11.md) | The project uses Entity Framework Core, Cosmos DB or SQL Server |
|
|
60
|
+
| [cryptography-dotnet10to11.md](references/cryptography-dotnet10to11.md) | The project uses cryptography APIs, client certificates or runs on macOS |
|
|
61
|
+
| [runtime-jit-dotnet10to11.md](references/runtime-jit-dotnet10to11.md) | Deployment targets include older hardware, embedded devices or NativeAOT |
|
|
62
|
+
|
|
63
|
+
For each error, find the matching entry, confirm on the linked Microsoft page that it applies to the SDK and target in use, and apply the smallest documented fix. A change the references do not list is not proof the change is absent.
|
|
64
|
+
|
|
65
|
+
### Step 4: Review behavioral changes
|
|
66
|
+
|
|
67
|
+
Behavioral changes compile but change runtime results. Use the references to decide which apply to the code, and cover each applicable one with a test or an explicit decision:
|
|
68
|
+
|
|
69
|
+
- Compression, ZIP and TAR reading and writing behavior.
|
|
70
|
+
- `MemoryStream` capacity and exception types.
|
|
71
|
+
- `BackgroundService` exceptions that now propagate from `RunAsync` and change the exit code.
|
|
72
|
+
- Client certificate chain validation and cryptography availability by platform.
|
|
73
|
+
- EF Core provider behavior, including Cosmos DB async-only I/O.
|
|
74
|
+
- Hardware minimums and NativeAOT output names for the deployment targets.
|
|
75
|
+
|
|
76
|
+
### Step 5: Update infrastructure within scope
|
|
77
|
+
|
|
78
|
+
1. Dockerfiles and CI: change SDK or image tags only as far as the approved upgrade scope requires, using the repository's tag convention.
|
|
79
|
+
2. `global.json`: edit the existing file and preserve other keys such as `rollForward`; use the SDK version the repository approves.
|
|
80
|
+
3. Verify deployment targets meet the hardware requirements in the runtime reference.
|
|
81
|
+
|
|
82
|
+
### Step 6: Verify
|
|
83
|
+
|
|
84
|
+
1. Run the repository's full gates: build, tests and any CI checks for the changed projects.
|
|
85
|
+
2. Build and test container images when the repository ships them.
|
|
86
|
+
3. A clean build does not finish an upgrade. Run behavioral tests for the applicable changes from Step 4 and review the diff for unintended behavior changes.
|
|
87
|
+
4. Report which references were consulted, which Microsoft pages confirmed applicability, and which gates were run.
|
|
88
|
+
|
|
89
|
+
## Pitfalls
|
|
90
|
+
|
|
91
|
+
| Pitfall | Correction |
|
|
92
|
+
|---------|------------|
|
|
93
|
+
| Dropping `net10.0` because the SDK is 11 | The SDK version is not the target; keep supported targets |
|
|
94
|
+
| Upgrading every Microsoft package to 11.x | Change only pinned versions the approved scope requires |
|
|
95
|
+
| Treating the bundled references as complete | They are a starting checklist; verify against Microsoft documentation |
|
|
96
|
+
| Declaring done after a clean build | Run behavioral tests and CI gates |
|
|
97
|
+
| Adopting C# 15 features during the migration | Follow `csharp.md`; migration is not a feature change |
|
package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/aspnetcore-dotnet10to11.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ASP.NET Core Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
These breaking changes affect ASP.NET Core projects. Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/11
|
|
4
|
+
|
|
5
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
6
|
+
|
|
7
|
+
## Source-Incompatible Changes
|
|
8
|
+
|
|
9
|
+
### Microsoft.OpenApi updated to v3 with OpenAPI 3.2 support
|
|
10
|
+
|
|
11
|
+
**Impact: Medium.** `Microsoft.AspNetCore.OpenApi` updated its dependency from `Microsoft.OpenApi` 2.x to 3.x, adding OpenAPI 3.2 document generation. The underlying `Microsoft.OpenApi` library has breaking API changes in the v2→v3 transition.
|
|
12
|
+
|
|
13
|
+
Code that directly uses `Microsoft.OpenApi` types (`OpenApiDocument`, `OpenApiSchema`, `OpenApiOperation`, etc.) will have compile errors.
|
|
14
|
+
|
|
15
|
+
**Fix:** Follow the [Microsoft.OpenApi v3 upgrade guide](https://github.com/microsoft/OpenAPI.NET/blob/main/docs/upgrade-guide-3.md). If you only use the ASP.NET Core OpenAPI integration (`.WithOpenApi()`, `MapOpenApi()`) without touching the object model directly, no changes are needed.
|
|
16
|
+
|
|
17
|
+
## Behavioral Changes
|
|
18
|
+
|
|
19
|
+
### Blazor Virtualize<T> default OverscanCount changed from 3 to 15
|
|
20
|
+
|
|
21
|
+
**Impact: Low.** The default `OverscanCount` on the `Virtualize<TItem>` component changed from `3` to `15` to support variable-height item measurement. `QuickGrid` retains its own default of `3`.
|
|
22
|
+
|
|
23
|
+
**Fix:** If performance-sensitive, set `OverscanCount` explicitly: `<Virtualize OverscanCount="3" />`.
|
|
24
|
+
|
package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/core-libraries-dotnet10to11.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Core .NET Libraries Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Obsoleted APIs
|
|
6
|
+
- Behavioral Changes
|
|
7
|
+
|
|
8
|
+
## Obsoleted APIs
|
|
9
|
+
|
|
10
|
+
These breaking changes affect all .NET 11 projects regardless of application type. Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/11
|
|
11
|
+
|
|
12
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
13
|
+
|
|
14
|
+
### NamedPipeClientStream constructor with `isConnected` parameter obsoleted (SYSLIB0063)
|
|
15
|
+
|
|
16
|
+
**Impact: High (for projects using `TreatWarningsAsErrors`).** The `NamedPipeClientStream` constructor overload that accepts a `bool isConnected` parameter has been obsoleted. The `isConnected` argument never had any effect — pipes created from an existing `SafePipeHandle` are always connected. A new constructor without the parameter has been added.
|
|
17
|
+
|
|
18
|
+
```csharp
|
|
19
|
+
// .NET 10: compiles without warning
|
|
20
|
+
var pipe = new NamedPipeClientStream(PipeDirection.InOut, isAsync: true, isConnected: true, safePipeHandle);
|
|
21
|
+
|
|
22
|
+
// .NET 11: SYSLIB0063 warning (error with TreatWarningsAsErrors)
|
|
23
|
+
// Fix: remove the isConnected parameter
|
|
24
|
+
var pipe = new NamedPipeClientStream(PipeDirection.InOut, isAsync: true, safePipeHandle);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Fix:** Remove the `isConnected` argument and use the new 3-parameter constructor `NamedPipeClientStream(PipeDirection, bool isAsync, SafePipeHandle)`.
|
|
28
|
+
|
|
29
|
+
## Behavioral Changes
|
|
30
|
+
|
|
31
|
+
### DeflateStream and GZipStream write headers and footers for empty payloads
|
|
32
|
+
|
|
33
|
+
**Impact: Medium.** `DeflateStream` and `GZipStream` now always write format headers and footers to the output stream, even when no data is written. Previously, these streams produced no output for empty payloads.
|
|
34
|
+
|
|
35
|
+
This ensures the output is a valid compressed stream per the Deflate and GZip specifications, but code that checks for zero-length output will need updating.
|
|
36
|
+
|
|
37
|
+
```csharp
|
|
38
|
+
// .NET 10: output stream is empty (0 bytes)
|
|
39
|
+
// .NET 11: output stream contains valid headers/footers
|
|
40
|
+
using var ms = new MemoryStream();
|
|
41
|
+
using (var gz = new GZipStream(ms, CompressionMode.Compress, leaveOpen: true))
|
|
42
|
+
{
|
|
43
|
+
// write nothing
|
|
44
|
+
}
|
|
45
|
+
// ms.Length was 0 in .NET 10, now > 0 in .NET 11
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Fix:** If your code checks for empty output to detect "no data was compressed," check the uncompressed byte count instead, or adjust the length check to account for headers/footers.
|
|
49
|
+
|
|
50
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/11/deflatestream-gzipstream-empty-payload
|
|
51
|
+
|
|
52
|
+
### MemoryStream maximum capacity updated and exception behavior changed
|
|
53
|
+
|
|
54
|
+
**Impact: Medium.** The maximum capacity of `MemoryStream` has been updated and the exception behavior for exceeding capacity has changed.
|
|
55
|
+
|
|
56
|
+
**Fix:** Review code that creates very large `MemoryStream` instances or catches specific exception types related to capacity limits.
|
|
57
|
+
|
|
58
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/11/memorystream-max-capacity
|
|
59
|
+
|
|
60
|
+
### TAR-reading APIs verify header checksums when reading
|
|
61
|
+
|
|
62
|
+
**Impact: Medium.** TAR-reading APIs now verify header checksums during reading. Previously, invalid checksums were silently ignored.
|
|
63
|
+
|
|
64
|
+
```csharp
|
|
65
|
+
// .NET 11: throws if TAR header checksum is invalid
|
|
66
|
+
using var reader = new TarReader(stream);
|
|
67
|
+
var entry = reader.GetNextEntry(); // may throw for corrupted files
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Fix:** Ensure TAR files have valid checksums. If processing hand-crafted or legacy TAR files, add error handling for checksum validation failures.
|
|
71
|
+
|
|
72
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/11/tar-checksum-validation
|
|
73
|
+
|
|
74
|
+
### ZipArchive.CreateAsync eagerly loads ZIP archive entries
|
|
75
|
+
|
|
76
|
+
**Impact: Low.** `ZipArchive.CreateAsync` now eagerly loads ZIP archive entries instead of lazy loading. This may affect memory usage for very large archives.
|
|
77
|
+
|
|
78
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/11/ziparchive-createasync-eager-load
|
|
79
|
+
|
|
80
|
+
### Environment.TickCount made consistent with Windows timeout behavior
|
|
81
|
+
|
|
82
|
+
**Impact: Low.** `Environment.TickCount` behavior has been made consistent with Windows timeout behavior. Code that relies on specific tick count wrapping or comparison patterns may need adjustment.
|
|
83
|
+
|
|
84
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/11/environment-tickcount-windows-behavior
|
|
85
|
+
|
|
86
|
+
### Globalization: Japanese Calendar minimum supported date corrected
|
|
87
|
+
|
|
88
|
+
**Impact: Low.** The minimum supported date for the Japanese Calendar has been corrected. Code using very early dates in the Japanese Calendar may be affected.
|
|
89
|
+
|
|
90
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/globalization/11/japanese-calendar-min-date
|
|
91
|
+
|
|
92
|
+
### ZipArchive now validates CRC32 when reading entries
|
|
93
|
+
|
|
94
|
+
**Impact: Low–Medium.** ZIP archive reads now validate the CRC32 checksum of each entry. Previously, corrupt or truncated archives were silently accepted; they now throw `InvalidDataException`.
|
|
95
|
+
|
|
96
|
+
**Fix:** Ensure ZIP files are not corrupted. If processing partially-written or legacy archives, add error handling for `InvalidDataException`.
|
|
97
|
+
|
|
98
|
+
### BackgroundService failures now propagate from the host
|
|
99
|
+
|
|
100
|
+
**Impact: Medium.** Since .NET 6 the default `BackgroundServiceExceptionBehavior.StopHost` already stops the host when `ExecuteAsync()` throws. What changes in .NET 11 is how that stop is reported: `IHost.RunAsync()`/`StopAsync()` (and so `Run()`) now rethrow the background service exception instead of returning normally, so the process exits with a non-zero code.
|
|
101
|
+
|
|
102
|
+
```csharp
|
|
103
|
+
// .NET 10: host stops, RunAsync returns normally, exit code 0
|
|
104
|
+
// .NET 11: host stops, RunAsync throws the service's exception, exit code non-zero
|
|
105
|
+
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
106
|
+
{
|
|
107
|
+
throw new InvalidOperationException("oops");
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Fix:** Do not add a catch-all in `ExecuteAsync()` to restore the old exit code; that hides real failures and keeps the host running in a broken state. Instead, check callers of `RunAsync()`/`Run()`, scripts, health checks and orchestrators that relied on a zero exit code after a background failure, and handle or log the propagated exception at the host entry point where that is intended. Services that must keep running after a recoverable error should handle that specific error inside their work loop.
|
|
112
|
+
|
|
113
|
+
### TarWriter emits HardLink entries for hard-linked files
|
|
114
|
+
|
|
115
|
+
**Impact: Low.** When `TarWriter` archives a directory containing hard links, the same inode encountered more than once is now written as a `HardLink` entry pointing back to the first occurrence, rather than duplicating the file data.
|
|
116
|
+
|
|
117
|
+
**Fix:** If consuming tar archives produced by .NET code, ensure the reader handles `HardLink` entry types.
|
|
118
|
+
|
|
119
|
+
### Zstandard APIs moved from preview package to System.IO.Compression
|
|
120
|
+
|
|
121
|
+
**Impact: Low.** `ZstandardStream` and related APIs that were previously in the `System.IO.Compression.Zstandard` preview NuGet package are now in-box in `System.IO.Compression`.
|
|
122
|
+
|
|
123
|
+
**Fix:** Remove the `<PackageReference Include="System.IO.Compression.Zstandard" />` preview package if present. The APIs are now available without any additional package reference.
|
|
124
|
+
|
package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/cryptography-dotnet10to11.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Cryptography Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
These breaking changes affect projects using cryptography APIs. Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/11
|
|
4
|
+
|
|
5
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
6
|
+
|
|
7
|
+
## Behavioral Changes
|
|
8
|
+
|
|
9
|
+
### DSA removed from macOS
|
|
10
|
+
|
|
11
|
+
**Impact: Medium (macOS only).** DSA (Digital Signature Algorithm) has been removed from macOS. Code that uses DSA for signing or verification will throw on macOS.
|
|
12
|
+
|
|
13
|
+
```csharp
|
|
14
|
+
// BREAKS on macOS in .NET 11
|
|
15
|
+
using var dsa = DSA.Create();
|
|
16
|
+
var signature = dsa.SignData(data, HashAlgorithmName.SHA256);
|
|
17
|
+
|
|
18
|
+
// FIX: Use a different algorithm
|
|
19
|
+
using var ecdsa = ECDsa.Create();
|
|
20
|
+
var signature = ecdsa.SignData(data, HashAlgorithmName.SHA256);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Fix:** Migrate from DSA to a more modern algorithm:
|
|
24
|
+
- **ECDSA** — recommended replacement for digital signatures
|
|
25
|
+
- **RSA** — alternative if ECDSA is not suitable
|
|
26
|
+
- **Ed25519** — if available in your scenario
|
|
27
|
+
|
|
28
|
+
This change only affects macOS. DSA continues to work on Windows and Linux (though it is generally considered a legacy algorithm).
|
|
29
|
+
|
|
30
|
+
### AIA certificate downloads disabled by default during client-certificate validation
|
|
31
|
+
|
|
32
|
+
**Impact: Medium.** AIA (Authority Information Access) certificate downloads are now disabled by default when performing server-side client-certificate chain validation. Previously the runtime would attempt to fetch intermediate CA certificates online.
|
|
33
|
+
|
|
34
|
+
**Fix:** If using mTLS where client certificates rely on AIA URLs for intermediate CAs, either:
|
|
35
|
+
- Pre-install the full certificate chain on the server
|
|
36
|
+
- Have clients send the full chain including intermediates
|
|
37
|
+
- Re-enable AIA downloads via `X509ChainPolicy.DisableCertificateDownloads = false`
|
|
38
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# C# 15 Compiler Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Source-Incompatible Changes
|
|
6
|
+
- New Language Features (non-breaking but relevant)
|
|
7
|
+
|
|
8
|
+
## Source-Incompatible Changes
|
|
9
|
+
|
|
10
|
+
These breaking changes are introduced by the Roslyn compiler shipping with the .NET 11 SDK. They affect all projects targeting `net11.0` (which uses C# 15 by default). These are maintained separately from the runtime breaking changes at: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/breaking-changes/compiler%20breaking%20changes%20-%20dotnet%2011
|
|
11
|
+
|
|
12
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
13
|
+
|
|
14
|
+
### Span/ReadOnlySpan collection expression safe-context changed to `declaration-block`
|
|
15
|
+
|
|
16
|
+
**Impact: Medium.** The safe-context of a collection expression of `Span<T>` or `ReadOnlySpan<T>` type is now `declaration-block`, matching the specification. Previously the compiler incorrectly used `function-member`.
|
|
17
|
+
|
|
18
|
+
This can cause new errors when assigning a span collection expression created in an inner scope to a variable in an outer scope:
|
|
19
|
+
|
|
20
|
+
```csharp
|
|
21
|
+
// BREAKS — new error
|
|
22
|
+
scoped Span<int> items1 = default;
|
|
23
|
+
foreach (var x in new[] { 1, 2 })
|
|
24
|
+
{
|
|
25
|
+
Span<int> items = [x];
|
|
26
|
+
if (x == 1)
|
|
27
|
+
items1 = items; // error: safe-context is declaration-block
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// FIX option 1: Use an array type
|
|
31
|
+
foreach (var x in new[] { 1, 2 })
|
|
32
|
+
{
|
|
33
|
+
int[] items = [x];
|
|
34
|
+
if (x == 1)
|
|
35
|
+
items1 = items; // ok, using int[] conversion to Span<int>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// FIX option 2: Move collection expression to outer scope
|
|
39
|
+
Span<int> items = [0];
|
|
40
|
+
foreach (var x in new[] { 1, 2 })
|
|
41
|
+
{
|
|
42
|
+
items[0] = x;
|
|
43
|
+
if (x == 1)
|
|
44
|
+
items1 = items; // ok
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `ref readonly` synthesized delegates require `InAttribute`
|
|
49
|
+
|
|
50
|
+
**Impact: Low.** When the compiler synthesizes a delegate type for a `ref readonly`-returning method or lambda, it now properly emits metadata requiring `System.Runtime.InteropServices.InAttribute`.
|
|
51
|
+
|
|
52
|
+
```csharp
|
|
53
|
+
class RefHelper
|
|
54
|
+
{
|
|
55
|
+
private static int value = 42;
|
|
56
|
+
|
|
57
|
+
public void M()
|
|
58
|
+
{
|
|
59
|
+
// May cause CS0518 if InAttribute is not available
|
|
60
|
+
var methodDelegate = this.MethodWithRefReadonlyReturn;
|
|
61
|
+
var lambdaDelegate = ref readonly int () => ref value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Fix:** Add a reference to an assembly defining `System.Runtime.InteropServices.InAttribute` (typically available via the default runtime references).
|
|
67
|
+
|
|
68
|
+
### `ref readonly` local functions require `InAttribute`
|
|
69
|
+
|
|
70
|
+
**Impact: Low.** Same as above but for `ref readonly`-returning local functions.
|
|
71
|
+
|
|
72
|
+
```csharp
|
|
73
|
+
void Method()
|
|
74
|
+
{
|
|
75
|
+
int x = 0;
|
|
76
|
+
ref readonly int local() => ref x; // CS0518 if InAttribute missing
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Fix:** Same as above — ensure `InAttribute` is available.
|
|
81
|
+
|
|
82
|
+
### Dynamic `&&`/`||` with interface left operand disallowed
|
|
83
|
+
|
|
84
|
+
**Impact: Low.** The compiler now reports a compile-time error when an interface type with `true`/`false` operators is used as the left operand of `&&` or `||` with a `dynamic` right operand. Previously this compiled but threw `RuntimeBinderException` at runtime.
|
|
85
|
+
|
|
86
|
+
```csharp
|
|
87
|
+
interface I1
|
|
88
|
+
{
|
|
89
|
+
static bool operator true(I1 x) => false;
|
|
90
|
+
static bool operator false(I1 x) => false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
class C1 : I1
|
|
94
|
+
{
|
|
95
|
+
public static C1 operator &(C1 x, C1 y) => x;
|
|
96
|
+
public static bool operator true(C1 x) => false;
|
|
97
|
+
public static bool operator false(C1 x) => false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
void M()
|
|
101
|
+
{
|
|
102
|
+
I1 x = new C1();
|
|
103
|
+
dynamic y = new C1();
|
|
104
|
+
_ = x && y; // error CS7083
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Fix:** Cast the left operand to a concrete type or to `dynamic`:
|
|
109
|
+
```csharp
|
|
110
|
+
_ = (C1)x && y; // valid
|
|
111
|
+
_ = (dynamic)x && y; // valid
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `nameof(this.)` in attributes disallowed
|
|
115
|
+
|
|
116
|
+
**Impact: Low.** Using `this` or `base` inside `nameof` in an attribute is now properly disallowed per the language specification. This was unintentionally permitted since C# 12.
|
|
117
|
+
|
|
118
|
+
```csharp
|
|
119
|
+
// Before (.NET 10) — compiled but was unintentionally permitted
|
|
120
|
+
class C
|
|
121
|
+
{
|
|
122
|
+
string P;
|
|
123
|
+
[System.Obsolete(nameof(this.P))]
|
|
124
|
+
void M() { }
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```csharp
|
|
129
|
+
// After (.NET 11) — remove 'this.' qualifier
|
|
130
|
+
class C
|
|
131
|
+
{
|
|
132
|
+
string P;
|
|
133
|
+
[System.Obsolete(nameof(P))]
|
|
134
|
+
void M() { }
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### `with()` as collection expression element (C# 15)
|
|
139
|
+
|
|
140
|
+
**Impact: Low.** When `LangVersion` is 15 or greater, `with(...)` as an element in a collection expression is treated as constructor/factory arguments (the new "collection expression arguments" feature), not as a call to a method named `with`.
|
|
141
|
+
|
|
142
|
+
```csharp
|
|
143
|
+
object x, y, z = ...;
|
|
144
|
+
object[] items;
|
|
145
|
+
|
|
146
|
+
items = [with(x, y), z]; // C# 14: call to with() method; C# 15: error
|
|
147
|
+
items = [@with(x, y), z]; // fix: escape to call method named 'with'
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Parsing of `when` in switch-expression-arm
|
|
151
|
+
|
|
152
|
+
**Impact: Low.** In a switch expression, `(X.Y) when` is now parsed as a constant pattern `(X.Y)` followed by a `when` clause. Previously it was parsed as a cast expression casting `when` to `(X.Y)`.
|
|
153
|
+
|
|
154
|
+
## New Language Features (non-breaking but relevant)
|
|
155
|
+
|
|
156
|
+
### Collection expression arguments
|
|
157
|
+
|
|
158
|
+
C# 15 adds `with(...)` syntax as the first element of a collection expression, allowing constructor/factory arguments:
|
|
159
|
+
|
|
160
|
+
```csharp
|
|
161
|
+
List<string> names = [with(capacity: values.Count * 2), .. values];
|
|
162
|
+
HashSet<string> set = [with(StringComparer.OrdinalIgnoreCase), "Hello", "HELLO"];
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This is the feature that causes the `with()` method call breaking change above. Whether to adopt it in Cratis code is decided by [csharp.md](../../../rules/csharp.md), not by this migration.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Entity Framework Core Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
These breaking changes affect projects using Entity Framework Core 11. Source: https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-11.0/breaking-changes
|
|
4
|
+
|
|
5
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- Medium-Impact Changes
|
|
10
|
+
- Additional changes
|
|
11
|
+
|
|
12
|
+
## Medium-Impact Changes
|
|
13
|
+
|
|
14
|
+
### Sync I/O via the Azure Cosmos DB provider has been fully removed
|
|
15
|
+
|
|
16
|
+
**Impact: Medium.** Synchronous I/O via the Azure Cosmos DB provider has been completely removed. In EF Core 10, sync I/O was unsupported by default but could be re-enabled with a special opt-in. In EF Core 11, calling any synchronous I/O API always throws — there is no opt-in to restore the old behavior.
|
|
17
|
+
|
|
18
|
+
**Affected APIs:**
|
|
19
|
+
- `ToList()`, `First()`, `Single()`, `Count()`, and other synchronous LINQ operators
|
|
20
|
+
- `SaveChanges()`
|
|
21
|
+
- Any synchronous query execution against the Cosmos DB provider
|
|
22
|
+
|
|
23
|
+
```csharp
|
|
24
|
+
// BREAKS in EF Core 11 — always throws
|
|
25
|
+
var items = context.Items.ToList();
|
|
26
|
+
context.SaveChanges();
|
|
27
|
+
|
|
28
|
+
// FIX: Use async equivalents
|
|
29
|
+
var items = await context.Items.ToListAsync();
|
|
30
|
+
await context.SaveChangesAsync();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Why:** Synchronous blocking on asynchronous methods ("sync-over-async") can lead to deadlocks and performance problems. Since the Azure Cosmos DB SDK only supports async methods, the EF Cosmos provider now requires async throughout.
|
|
34
|
+
|
|
35
|
+
**Fix:** Convert all synchronous I/O calls to their async equivalents:
|
|
36
|
+
- `ToList()` → `await ToListAsync()`
|
|
37
|
+
- `First()` → `await FirstAsync()`
|
|
38
|
+
- `Single()` → `await SingleAsync()`
|
|
39
|
+
- `Count()` → `await CountAsync()`
|
|
40
|
+
- `SaveChanges()` → `await SaveChangesAsync()`
|
|
41
|
+
- `Any()` → `await AnyAsync()`
|
|
42
|
+
|
|
43
|
+
### Cosmos: empty owned collections return empty collection instead of null
|
|
44
|
+
|
|
45
|
+
**Impact: Low.** When a Cosmos-backed entity has an owned collection with no items, the property now returns an empty collection rather than `null`.
|
|
46
|
+
|
|
47
|
+
**Fix:** Update null checks to empty-collection checks: `if (entity.Items is null)` → `if (entity.Items.Count == 0)`.
|
|
48
|
+
|
|
49
|
+
## Additional changes
|
|
50
|
+
|
|
51
|
+
### RelationalEventId.MigrationsNotFound now throws by default
|
|
52
|
+
|
|
53
|
+
**Impact: Low.** Calling `Migrate()` or `MigrateAsync()` when no migrations exist in the assembly now throws an exception rather than silently logging.
|
|
54
|
+
|
|
55
|
+
**Fix:** If intentional, suppress with: `options.ConfigureWarnings(w => w.Ignore(RelationalEventId.MigrationsNotFound))`.
|
|
56
|
+
|
|
57
|
+
### EF Core Tools and Tasks no longer transitively depend on Design
|
|
58
|
+
|
|
59
|
+
**Impact: Low.** The `Microsoft.EntityFrameworkCore.Tools` and `Microsoft.EntityFrameworkCore.Tasks` NuGet packages no longer have a transitive dependency on `Microsoft.EntityFrameworkCore.Design`.
|
|
60
|
+
|
|
61
|
+
**Fix:** If your project relied on this transitive reference, add it explicitly:
|
|
62
|
+
|
|
63
|
+
```xml
|
|
64
|
+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="11.0.0" PrivateAssets="all" />
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### EFOptimizeContext MSBuild property removed
|
|
68
|
+
|
|
69
|
+
**Impact: Low.** The `<EFOptimizeContext>true</EFOptimizeContext>` MSBuild property no longer exists. Code generation is now controlled by `<EFScaffoldModelStage>` and `<EFPrecompileQueriesStage>`.
|
|
70
|
+
|
|
71
|
+
**Fix:** Replace `<EFOptimizeContext>` with the two new properties. With `PublishAOT=true`, generation is automatic during publish.
|
|
72
|
+
|
|
73
|
+
### SqlVector<T> properties excluded from SELECT by default
|
|
74
|
+
|
|
75
|
+
**Impact: Low.** `SqlVector<T>` properties are now excluded from `SELECT` statements when materializing entities (they return `null`). They can still be used in `WHERE`/`ORDER BY` for vector search.
|
|
76
|
+
|
|
77
|
+
**Fix:** Use explicit projections to include vector values: `.Select(b => new { b.Id, b.Embedding })`.
|
|
78
|
+
|
|
79
|
+
### Microsoft.Data.SqlClient updated to 7.0
|
|
80
|
+
|
|
81
|
+
**Impact: Medium.** EF Core's SQL Server provider now depends on `Microsoft.Data.SqlClient` 7.0. In v7, Azure/Entra ID authentication dependencies (`Azure.Core`, `Azure.Identity`, `Microsoft.Identity.Client`) have been removed from the core package.
|
|
82
|
+
|
|
83
|
+
**Fix:** If using Entra ID authentication (e.g., `ActiveDirectoryDefault`, `ActiveDirectoryManagedIdentity`), add:
|
|
84
|
+
|
|
85
|
+
```xml
|
|
86
|
+
<PackageReference Include="Microsoft.Data.SqlClient.Extensions.Azure" Version="7.0.0" />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Encryption-enabled SQLite packages removed
|
|
90
|
+
|
|
91
|
+
**Impact: Medium.** `SQLitePCLRaw 3.0` (used by `Microsoft.Data.Sqlite` 11) removed `bundle_e_sqlcipher` and several other bundle packages.
|
|
92
|
+
|
|
93
|
+
**Fix:** Switch to SQLite Encryption Extension (SEE), SQLCipher from Zetetic, or `SQLite3MultipleCiphers-NuGet`.
|
|
94
|
+
|
package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/runtime-jit-dotnet10to11.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Runtime and JIT Compiler Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
These breaking changes affect the .NET runtime and JIT compiler. Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/11
|
|
4
|
+
|
|
5
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
6
|
+
|
|
7
|
+
## Behavioral Changes
|
|
8
|
+
|
|
9
|
+
### Minimum hardware requirements updated
|
|
10
|
+
|
|
11
|
+
**Impact: High for deployments on older hardware.** .NET 11 updates the minimum hardware requirements for both x86/x64 and Arm64 architectures.
|
|
12
|
+
|
|
13
|
+
#### x86/x64 changes
|
|
14
|
+
|
|
15
|
+
The baseline is updated from `x86-64-v1` to `x86-64-v2` on all operating systems. This means the minimum CPU must support:
|
|
16
|
+
- `CMOV`, `CX8`, `SSE`, `SSE2` (previously required)
|
|
17
|
+
- `CX16`, `POPCNT`, `SSE3`, `SSSE3`, `SSE4.1`, `SSE4.2` (newly required)
|
|
18
|
+
|
|
19
|
+
This aligns with Windows 11 requirements and covers all Intel/AMD CPUs still in official support (older chips went out of support around 2013).
|
|
20
|
+
|
|
21
|
+
The ReadyToRun (R2R) target is updated to `x86-64-v3` for Windows and Linux, adding `AVX`, `AVX2`, `BMI1`, `BMI2`, `F16C`, `FMA`, `LZCNT`, and `MOVBE`. Hardware that meets `x86-64-v2` but not `x86-64-v3` will experience additional JIT overhead at startup.
|
|
22
|
+
|
|
23
|
+
| OS | Previous JIT/AOT min | New JIT/AOT min | Previous R2R target | New R2R target |
|
|
24
|
+
|----|---------------------|-----------------|--------------------|--------------------|
|
|
25
|
+
| Apple | x86-64-v1 | x86-64-v2 | x86-64-v2 | (No change) |
|
|
26
|
+
| Linux | x86-64-v1 | x86-64-v2 | x86-64-v2 | x86-64-v3 |
|
|
27
|
+
| Windows | x86-64-v1 | x86-64-v2 | x86-64-v2 | x86-64-v3 |
|
|
28
|
+
|
|
29
|
+
#### Arm64 changes
|
|
30
|
+
|
|
31
|
+
- **Apple**: No change to minimum hardware or R2R target.
|
|
32
|
+
- **Linux**: No change to minimum hardware (still supports Raspberry Pi). R2R target updated to include `LSE`.
|
|
33
|
+
- **Windows**: Baseline updated to require `LSE` (Load-Store Exclusive), required by Windows 11 and all Arm64 CPUs officially supported by Windows 10. R2R target updated to `armv8.2-a + RCPC`.
|
|
34
|
+
|
|
35
|
+
| OS | Previous JIT/AOT min | New JIT/AOT min | Previous R2R target | New R2R target |
|
|
36
|
+
|----|---------------------|-----------------|--------------------|--------------------|
|
|
37
|
+
| Apple | Apple M1 | (No change) | Apple M1 | (No change) |
|
|
38
|
+
| Linux | armv8.0-a | (No change) | armv8.0-a | armv8.0-a + LSE |
|
|
39
|
+
| Windows | armv8.0-a | armv8.0-a + LSE | armv8.0-a | armv8.2-a + RCPC |
|
|
40
|
+
|
|
41
|
+
#### Impact
|
|
42
|
+
|
|
43
|
+
Starting with .NET 11, .NET fails to run on older hardware and prints:
|
|
44
|
+
|
|
45
|
+
> The current CPU is missing one or more of the baseline instruction sets.
|
|
46
|
+
|
|
47
|
+
For ReadyToRun-capable assemblies, there may be additional startup overhead on supported hardware that doesn't meet the R2R target.
|
|
48
|
+
|
|
49
|
+
**Fix:** Verify all deployment targets meet the new minimum requirements. For x86/x64, any CPU from ~2013 or later should be fine. For Windows Arm64, ensure `LSE` support (all Windows 11 compatible Arm64 devices).
|
|
50
|
+
|
|
51
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/jit/11/minimum-hardware-requirements
|
|
52
|
+
|
|
53
|
+
### NativeAOT native-library outputs use `lib` prefix on Unix
|
|
54
|
+
|
|
55
|
+
**Impact: Low.** NativeAOT shared/native library outputs on Linux and macOS now follow Unix conventions and include the `lib` prefix (e.g., `libMyLib.so` instead of `MyLib.so`).
|
|
56
|
+
|
|
57
|
+
**Fix:** Update build scripts, deployment pipelines, or P/Invoke declarations that reference output filenames by the old name without the `lib` prefix.
|
|
58
|
+
|
package/package/corpus/skills/migrate-dotnet10-to-dotnet11/references/sdk-msbuild-dotnet10to11.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# SDK and MSBuild Breaking Changes (.NET 11)
|
|
2
|
+
|
|
3
|
+
These changes affect the .NET SDK, CLI tooling, NuGet, and MSBuild behavior. Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/11
|
|
4
|
+
|
|
5
|
+
> **Note:** This checklist was captured from .NET 11 preview-era compatibility documentation and is not the exhaustive release contract. Confirm each item against the linked Microsoft compatibility page for the SDK and runtime in use before applying a fix.
|
|
6
|
+
|
|
7
|
+
## Behavioral Changes
|
|
8
|
+
|
|
9
|
+
### Mono launch target not set for .NET Framework apps
|
|
10
|
+
|
|
11
|
+
**Impact: Low.** The mono launch target is no longer set automatically for .NET Framework apps. If you require Mono for execution on Linux, you need to specify it explicitly in the configuration.
|
|
12
|
+
|
|
13
|
+
Source: https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/11/mono-launch-target-removed
|
|
14
|
+
|
|
15
|
+
### NETSDK1235 warning for PackAsTool with custom .nuspec
|
|
16
|
+
|
|
17
|
+
**Impact: Low.** A new build warning `NETSDK1235` is emitted when a project has both `PackAsTool=true` and a custom `NuspecFile` property, which violates .NET Tool packaging requirements. Projects with `TreatWarningsAsErrors=true` will fail.
|
|
18
|
+
|
|
19
|
+
**Fix:** Remove the custom `NuspecFile` property when packaging as a .NET Tool, or suppress the warning if the .nuspec is compatible.
|
|
20
|
+
|
|
21
|
+
### `dotnet publish --self-contained` now parses the passed value
|
|
22
|
+
|
|
23
|
+
**Impact: Low.** `dotnet publish --self-contained` previously always interpreted the flag as `true` regardless of the passed value. It now correctly parses the value (e.g., `--self-contained false` actually produces a framework-dependent publish).
|
|
24
|
+
|
|
25
|
+
**Fix:** Review build scripts that pass `--self-contained` to ensure the intended value is correct.
|
|
26
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Managed Code
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
pvanalyze
|
|
2
|
+
Copyright (c) 2026 Managed Code
|
|
3
|
+
Licensed under the MIT License. See LICENSE.
|
|
4
|
+
|
|
5
|
+
Upstream source: https://github.com/managedcode/dotnet-skills/blob/6c69830ec1b82bc69b1b3ffe576dc9214f51aa15/catalog/Tools/pvanalyze/skills/pvanalyze/SKILL.md
|
|
6
|
+
The references/ files come from the same directory at the same revision. The command surface was checked against the pvanalyze tool repository https://github.com/adityamandaleeka/pvanalyze at commit faec9b3dbdb15e019636bcf98864b0d99a549b66 (MIT, Aditya Mandaleeka) and the published package's `--help`. No tool source is copied.
|
|
7
|
+
|
|
8
|
+
Changes made by Cratis:
|
|
9
|
+
|
|
10
|
+
LICENSE:
|
|
11
|
+
- Copy upstream MIT license and copyright verbatim.
|
|
12
|
+
|
|
13
|
+
SKILL.md:
|
|
14
|
+
- Rewrite the description and compatibility to the Cratis routing shape and the real runtime requirement (Microsoft.NETCore.App 10.x).
|
|
15
|
+
- Remove the global tool install, floating `dnx`, source-build fallback, the net8 runtime claim, the dotnet-trace install and the collection recipes; route collection to the profiling skills.
|
|
16
|
+
- Add a pinned local-tool install route with a runtime preflight, an owned task directory and stop conditions.
|
|
17
|
+
- Add inconclusive-result handling, owned-copy and cache-file guidance, and a no-code-edit boundary.
|
|
18
|
+
- Add the marked modification/source comment and Cratis precedence line.
|
|
19
|
+
|
|
20
|
+
references/commands.md:
|
|
21
|
+
- Add a Contents list and a note to run commands through `dotnet tool run`.
|
|
22
|
+
- Replace the dotnet-trace collection commands with pointers to the profiling skills.
|
|
23
|
+
- Add the empty-allocation caveat and the owned-copy limit on `clean`.
|
|
24
|
+
|
|
25
|
+
references/overview.md:
|
|
26
|
+
- Rewrite without the install model, source-build fallback, version-prefix claims and collection commands.
|
|
27
|
+
|
|
28
|
+
references/install.md, assets/dotnet-tools.json, assets/NuGet.Config:
|
|
29
|
+
- Added by Cratis. The manifest pins the published package; the NuGet configuration clears all sources except nuget.org.
|
|
30
|
+
|
|
31
|
+
Executes or downloads (instructions in the skill, not executed by this import):
|
|
32
|
+
- references/install.md: dotnet tool restore --tool-manifest .config/dotnet-tools.json --configfile .config/NuGet.Config (downloads the pinned package from nuget.org after operator approval).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pvanalyze
|
|
3
|
+
description: Use when an existing .nettrace file needs offline GC, JIT, CPU stack, allocation, exception or call-tree analysis from the command line. Not for collecting traces, live processes or memory dumps.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires the Microsoft.NETCore.App 10.x runtime, checked with `dotnet --list-runtimes`; a .NET 11 SDK alone is not enough. Some commands need traces collected with allocation, DATAS or verbose runtime events.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Modified by Cratis from Managed Code's original (MIT): frontmatter, install, scope and the changes listed in NOTICE. Upstream: https://github.com/managedcode/dotnet-skills (catalog/Tools/pvanalyze/skills/pvanalyze/SKILL.md; see NOTICE) -->
|
|
9
|
+
|
|
10
|
+
# pvanalyze
|
|
11
|
+
|
|
12
|
+
Cratis rules in `.cratis/ai/rules/` and the `cratis-*` skills win where they differ. `pvanalyze` reads `.nettrace` files that already exist. Collecting a trace, attaching to a process, installing a profiler and capturing dumps belong to the `profiling`, `dotnet-trace-collect` and `dump-collect` skills, with explicit approval; never make them the default first step of an analysis.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
Read [references/install.md](references/install.md) before the first run. It explains the preflight (`dotnet --list-runtimes` must show Microsoft.NETCore.App 10.x), the approved nuget.org-only restore into an owned directory and the stop conditions. Copy these two assets into that directory's `.config/` as install.md describes:
|
|
17
|
+
|
|
18
|
+
- [assets/dotnet-tools.json](assets/dotnet-tools.json) holds the exact tool pin; use it as the only source of the version.
|
|
19
|
+
- [assets/NuGet.Config](assets/NuGet.Config) limits restore to nuget.org.
|
|
20
|
+
|
|
21
|
+
Run commands as `dotnet tool run pvanalyze -- <arguments>` from that directory. Do not install globally, use floating `dnx`, build from source or overwrite an existing manifest.
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
1. Confirm the trace path and whether it was collected with the events the question needs.
|
|
26
|
+
2. Copy the trace into an owned directory. Parsing writes a sibling `.pvanalyze.etlx` cache, so never analyze a trace in a directory you do not own.
|
|
27
|
+
3. Run `pvanalyze info <trace>` first to verify the file opens and contains the expected processes. Use `events --list` to see what was collected.
|
|
28
|
+
4. Pick one focused command and bound its output:
|
|
29
|
+
- `gcstats` for GC count, heap size and pause questions
|
|
30
|
+
- `alloc` for allocation by type
|
|
31
|
+
- `datas` for Dynamic Adaptation To Application Sizes heap-count tuning
|
|
32
|
+
- `jitstats` for JIT compilation cost
|
|
33
|
+
- `cpustacks` for top CPU methods, module or namespace grouping and SpeedScope export
|
|
34
|
+
- `calltree` for hot paths and caller/callee exploration
|
|
35
|
+
- `events` and `exceptions` for provider, event type, payload, PID, TID or thrown-exception filtering
|
|
36
|
+
- `timeline` and `snapshot` for time-bucketed or point-in-time context
|
|
37
|
+
5. Prefer `--format json` when another tool consumes the output, and add `--from`/`--to` only after a baseline run shows the interesting window.
|
|
38
|
+
6. Report the command, process, window and filters used, plus generated files such as a `.speedscope.json`.
|
|
39
|
+
|
|
40
|
+
Read [references/commands.md](references/commands.md) for the options of each command, and [references/overview.md](references/overview.md) for trace prerequisites and when to choose a different skill.
|
|
41
|
+
|
|
42
|
+
## Constraints
|
|
43
|
+
|
|
44
|
+
- A signal absent from the trace makes the result inconclusive. An empty `alloc`, `datas`, `exceptions` or `cpustacks` result is not evidence of zero allocations, no exceptions or no CPU time; check `events --list` and say what to recollect.
|
|
45
|
+
- Treat unexpected, empty or partially parsed output as inconclusive. The tool reading a trace does not prove it understands every runtime event.
|
|
46
|
+
- Run `clean` only on the owned copy. It removes `.pvanalyze.etlx` cache files.
|
|
47
|
+
- Analysis does not authorize editing product code; report findings and let the task decide the change.
|
|
48
|
+
- Static allocation review of source code and microbenchmarks belong to other skills.
|
|
49
|
+
|
|
50
|
+
## Validate
|
|
51
|
+
|
|
52
|
+
- `dotnet tool list --local` shows the version in the manifest, and `pvanalyze --help` and `info --help` run.
|
|
53
|
+
- `pvanalyze info <trace>` reads the trace before deeper analysis starts.
|
|
54
|
+
- JSON output parses when `--format json` is used.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# pvanalyze commands
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Baseline
|
|
6
|
+
- GC
|
|
7
|
+
- JIT
|
|
8
|
+
- CPU stacks
|
|
9
|
+
- Call tree
|
|
10
|
+
- Allocation
|
|
11
|
+
- DATAS
|
|
12
|
+
- Events
|
|
13
|
+
- Exceptions
|
|
14
|
+
- Timeline and snapshot
|
|
15
|
+
- Cache cleanup
|
|
16
|
+
|
|
17
|
+
## Baseline
|
|
18
|
+
|
|
19
|
+
Examples write `pvanalyze`; run them as `dotnet tool run pvanalyze -- <arguments>` from the directory that holds the restored tool manifest (see [install.md](install.md)). Analyze a copy of the trace in an owned directory, and bound output with `--top`, `--limit`, `--longest` or a time window.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pvanalyze --help
|
|
23
|
+
pvanalyze info ./trace.nettrace
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## GC
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pvanalyze gcstats ./trace.nettrace
|
|
30
|
+
pvanalyze gcstats ./trace.nettrace --format json
|
|
31
|
+
pvanalyze gcstats ./trace.nettrace --timeline
|
|
32
|
+
pvanalyze gcstats ./trace.nettrace --longest 5
|
|
33
|
+
pvanalyze gcstats ./trace.nettrace --from 1000 --to 2000 --timeline
|
|
34
|
+
pvanalyze gcstats ./trace.nettrace --process MyApp --format json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use for pause time, heap size, generation distribution, and per-GC timelines.
|
|
38
|
+
|
|
39
|
+
## JIT
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pvanalyze jitstats ./trace.nettrace
|
|
43
|
+
pvanalyze jitstats ./trace.nettrace --process MyApp --format json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Use for method compilation count, JIT CPU time, IL size, and native size signals.
|
|
47
|
+
|
|
48
|
+
## CPU stacks
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pvanalyze cpustacks ./trace.nettrace --top 20
|
|
52
|
+
pvanalyze cpustacks ./trace.nettrace --group-by module --top 10
|
|
53
|
+
pvanalyze cpustacks ./trace.nettrace --group-by namespace --inclusive
|
|
54
|
+
pvanalyze cpustacks ./trace.nettrace --from 1000 --to 2000 --top 10
|
|
55
|
+
pvanalyze cpustacks ./trace.nettrace --format json
|
|
56
|
+
pvanalyze cpustacks ./trace.nettrace --format speedscope --output ./trace.speedscope.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use `--inclusive` when parent cost matters more than leaf-frame self cost.
|
|
60
|
+
|
|
61
|
+
## Call tree
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pvanalyze calltree ./trace.nettrace --depth 5
|
|
65
|
+
pvanalyze calltree ./trace.nettrace --hot-path
|
|
66
|
+
pvanalyze calltree ./trace.nettrace --caller-callee "Serialize"
|
|
67
|
+
pvanalyze calltree ./trace.nettrace --hot-path --format json
|
|
68
|
+
pvanalyze calltree ./trace.nettrace --min-percent 2 --depth 6
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Use `--hot-path` for the dominant chain and `--caller-callee` for one method substring.
|
|
72
|
+
|
|
73
|
+
## Allocation
|
|
74
|
+
|
|
75
|
+
The trace must contain allocation events. Collection uses the `profiling` or `dotnet-trace-collect` skills with approval; the runtime provider needs the GC allocation keyword at verbose level.
|
|
76
|
+
|
|
77
|
+
Analyze:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pvanalyze alloc ./trace.nettrace --top 20
|
|
81
|
+
pvanalyze alloc ./trace.nettrace --group-by namespace --format json
|
|
82
|
+
pvanalyze alloc ./trace.nettrace --group-by module --from 1000 --to 2000
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use for top allocating types, LOH detection, and namespace or module-level allocation summaries. An empty result means the trace lacks allocation events or the window is empty; it is not evidence of zero allocations. Check `events --list` before concluding anything.
|
|
86
|
+
|
|
87
|
+
## DATAS
|
|
88
|
+
|
|
89
|
+
The trace must contain DATAS events, which need .NET 9 or later with DATAS enabled and verbose GC runtime events. Collection uses the `profiling` or `dotnet-trace-collect` skills with approval.
|
|
90
|
+
|
|
91
|
+
Analyze:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pvanalyze datas ./trace.nettrace
|
|
95
|
+
pvanalyze datas ./trace.nettrace --changes-only
|
|
96
|
+
pvanalyze datas ./trace.nettrace --samples
|
|
97
|
+
pvanalyze datas ./trace.nettrace --gen2
|
|
98
|
+
pvanalyze datas ./trace.nettrace --changes-only --format json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Use for server GC heap count, gen0 budget, tuning decisions, and gen2 full-GC backstop events.
|
|
102
|
+
|
|
103
|
+
## Events
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pvanalyze events ./trace.nettrace --list
|
|
107
|
+
pvanalyze events ./trace.nettrace --list --format json
|
|
108
|
+
pvanalyze events ./trace.nettrace --type GCStart
|
|
109
|
+
pvanalyze events ./trace.nettrace --provider DotNETRuntime --limit 50
|
|
110
|
+
pvanalyze events ./trace.nettrace --pid 1234
|
|
111
|
+
pvanalyze events ./trace.nettrace --tid 5678
|
|
112
|
+
pvanalyze events ./trace.nettrace --payload "ConnectionReset"
|
|
113
|
+
pvanalyze events ./trace.nettrace --from 500 --to 1000 --type GC
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Use event listing before guessing exact event names.
|
|
117
|
+
|
|
118
|
+
## Exceptions
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
pvanalyze exceptions ./trace.nettrace
|
|
122
|
+
pvanalyze exceptions ./trace.nettrace --type NullReference
|
|
123
|
+
pvanalyze exceptions ./trace.nettrace --limit 20 --format json
|
|
124
|
+
pvanalyze exceptions ./trace.nettrace --from 1000 --to 2000
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Use for thrown exception count and detail. This does not replace crash dump analysis.
|
|
128
|
+
|
|
129
|
+
## Timeline and snapshot
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pvanalyze timeline ./trace.nettrace
|
|
133
|
+
pvanalyze timeline ./trace.nettrace --lanes gc,cpu,exceptions,alloc,jit,events --buckets 80 --format json
|
|
134
|
+
pvanalyze snapshot ./trace.nettrace --at 1500 --window 100
|
|
135
|
+
pvanalyze snapshot ./trace.nettrace --at 1500 --window 250 --format json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Use these commands when an agent needs a compact cross-signal view for a time range or timestamp.
|
|
139
|
+
|
|
140
|
+
## Cache cleanup
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pvanalyze clean ./trace.nettrace
|
|
144
|
+
pvanalyze clean ./traces/
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Parsing writes `.pvanalyze.etlx` cache files beside the input. Run `clean` only on the owned copy of the trace or its directory, never on someone else's artifact directory.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# pvanalyze install
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Preflight](#preflight)
|
|
6
|
+
- [Restore into an owned directory](#restore-into-an-owned-directory)
|
|
7
|
+
- [Run and verify](#run-and-verify)
|
|
8
|
+
- [Stop conditions](#stop-conditions)
|
|
9
|
+
|
|
10
|
+
The tool version is pinned by [assets/dotnet-tools.json](../assets/dotnet-tools.json), a standard local tool manifest. [assets/NuGet.Config](../assets/NuGet.Config) clears every other package source and allows only nuget.org. Do not install the tool globally, run it through a floating `dnx` call, build it from source, or run a downloaded script. Restore only after the operator approves downloading from nuget.org. The package has no verified ID prefix and a tool manifest cannot pin its hash, so before approving, check on nuget.org that `pvanalyze` 0.0.1 is still published by the owner `adityam`; stop if the owner or version differs.
|
|
11
|
+
|
|
12
|
+
## Preflight
|
|
13
|
+
|
|
14
|
+
The published tool runs on the .NET 10 runtime. A .NET 11 SDK alone is not enough, and major-version roll-forward is not a workaround.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
dotnet --list-runtimes
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Require a `Microsoft.NETCore.App 10.x` line. If it is missing, stop and report the prerequisite gap; installing a runtime is a separate operator decision.
|
|
21
|
+
|
|
22
|
+
## Restore into an owned directory
|
|
23
|
+
|
|
24
|
+
Use a directory created for this task. Never replace an existing tool manifest or NuGet configuration: if the directory already has `.config/dotnet-tools.json`, choose another directory.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
mkdir -p <task-dir>/.config
|
|
28
|
+
cp <skill-dir>/assets/dotnet-tools.json <task-dir>/.config/dotnet-tools.json
|
|
29
|
+
cp <skill-dir>/assets/NuGet.Config <task-dir>/.config/NuGet.Config
|
|
30
|
+
cd <task-dir>
|
|
31
|
+
dotnet tool restore --tool-manifest .config/dotnet-tools.json --configfile .config/NuGet.Config
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Run and verify
|
|
35
|
+
|
|
36
|
+
Run from the task directory so the local manifest resolves:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
dotnet tool list --local
|
|
40
|
+
dotnet tool run pvanalyze -- --help
|
|
41
|
+
dotnet tool run pvanalyze -- info --help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`dotnet tool list --local` shows the installed version, which must match the manifest. Copy the trace into the task directory (or another owned directory) before running analysis commands, because parsing writes cache files beside it.
|
|
45
|
+
|
|
46
|
+
## Stop conditions
|
|
47
|
+
|
|
48
|
+
- No Microsoft.NETCore.App 10.x runtime: report it and stop.
|
|
49
|
+
- Restore needs a source other than nuget.org, credentials or a different package version: stop and ask.
|
|
50
|
+
- A command in [commands.md](commands.md) is missing from `--help` for the restored version: do not upgrade the pin automatically; drop that command from the plan and report it.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# pvanalyze overview
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [What the tool is](#what-the-tool-is)
|
|
6
|
+
- [When to choose pvanalyze](#when-to-choose-pvanalyze)
|
|
7
|
+
- [Trace prerequisites](#trace-prerequisites)
|
|
8
|
+
- [Operational notes](#operational-notes)
|
|
9
|
+
|
|
10
|
+
## What the tool is
|
|
11
|
+
|
|
12
|
+
`pvanalyze` is a command-line analyzer for .NET `.nettrace` files. It runs on macOS, Linux and Windows without the PerfView GUI and prints text, JSON or SpeedScope output. It reads traces with `Microsoft.Diagnostics.Tracing.TraceEvent` and caches a converted copy as a sibling `.pvanalyze.etlx` file for repeated reads.
|
|
13
|
+
|
|
14
|
+
Upstream project: <https://github.com/adityamandaleeka/pvanalyze>. `pvanalyze --help` and each command's `--help` list the options of the pinned version; trust them over any prose here.
|
|
15
|
+
|
|
16
|
+
## When to choose pvanalyze
|
|
17
|
+
|
|
18
|
+
Choose `pvanalyze` when:
|
|
19
|
+
|
|
20
|
+
- a `.nettrace` file already exists
|
|
21
|
+
- the answer should be terminal, JSON or SpeedScope output
|
|
22
|
+
- the workflow runs on a platform without the PerfView GUI, in scripts, in CI or by an agent
|
|
23
|
+
|
|
24
|
+
Choose the `profiling` or `dotnet-trace-collect` skills when the task is process discovery, live counters, provider selection or collecting the trace. Use dump skills for crash dumps; `pvanalyze` does not read dumps.
|
|
25
|
+
|
|
26
|
+
## Trace prerequisites
|
|
27
|
+
|
|
28
|
+
A command can only report what the trace contains:
|
|
29
|
+
|
|
30
|
+
- `alloc` needs allocation events in the runtime provider at verbose level.
|
|
31
|
+
- `datas` needs DATAS events, available on .NET 9 or later, with verbose GC runtime events.
|
|
32
|
+
- `cpustacks` and `calltree` need CPU sample events.
|
|
33
|
+
- `exceptions` needs exception events.
|
|
34
|
+
|
|
35
|
+
Use `events --list` to see what was collected before drawing a conclusion. A missing signal makes a result inconclusive; it never shows that the activity did not happen. The tool reading a trace does not guarantee it parses every runtime event of every runtime release; report unexpected or empty output as inconclusive rather than as a finding.
|
|
36
|
+
|
|
37
|
+
## Operational notes
|
|
38
|
+
|
|
39
|
+
- Keep the original `.nettrace`: replay cannot recreate events that were never collected.
|
|
40
|
+
- Work on a copy in an owned directory, because parsing writes `.pvanalyze.etlx` and lock files beside the input.
|
|
41
|
+
- Prefer `--format json` when another tool consumes the output, and `cpustacks --format speedscope --output <file>` for flame graph viewers.
|
|
@@ -1204,7 +1204,8 @@
|
|
|
1204
1204
|
"cratis-commits-and-pull-requests",
|
|
1205
1205
|
"cratis-rtk",
|
|
1206
1206
|
"dotnet-trace-collect",
|
|
1207
|
-
"dump-collect"
|
|
1207
|
+
"dump-collect",
|
|
1208
|
+
"pvanalyze"
|
|
1208
1209
|
],
|
|
1209
1210
|
"languages": [
|
|
1210
1211
|
"csharp"
|
|
@@ -1247,7 +1248,19 @@
|
|
|
1247
1248
|
"platform-detection",
|
|
1248
1249
|
"run-tests",
|
|
1249
1250
|
"filter-syntax",
|
|
1250
|
-
"coverage-analysis"
|
|
1251
|
+
"coverage-analysis",
|
|
1252
|
+
"exp-mock-usage-analysis"
|
|
1253
|
+
],
|
|
1254
|
+
"languages": [
|
|
1255
|
+
"csharp"
|
|
1256
|
+
]
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
"id": "cratis/engineering/dotnet/migrate-dotnet11",
|
|
1260
|
+
"availableTargets": [
|
|
1261
|
+
"cratis-commits-and-pull-requests",
|
|
1262
|
+
"cratis-rtk",
|
|
1263
|
+
"migrate-dotnet10-to-dotnet11"
|
|
1251
1264
|
],
|
|
1252
1265
|
"languages": [
|
|
1253
1266
|
"csharp"
|