Skip to content

Latest commit

 

History

History
451 lines (338 loc) · 17.4 KB

dev-environment.md

File metadata and controls

451 lines (338 loc) · 17.4 KB

Local development environment

This document owns repository SDK selection, build and test commands, package acquisition, and local tool activation. Start with the repository workflow.

SDK and normal build

Before any other dotnet command, inspect the available and selected SDK:

command -v dotnet
dotnet --list-sdks
dotnet --version

Use the SDK selected by repository configuration and CI, following Repository development SDK. Never replace or shadow a centrally installed dotnet; when the required SDK is absent, install it only under the current worktree as the repository instructions specify.

The repository selects stable .NET 11.0 SDKs, starting at 11.0.100. global.json uses latestFeature roll-forward, accepting newer installed 11.0 feature bands and patches but not prereleases or a newer major/minor. CI installs the latest stable 11.0.x SDK. Record the exact selected SDK for reproducible evidence.

The GA baseline includes runtime 11.0.0, which retains the fix for the Brotli decoder out-of-bounds write advisory GHSA-p3jp-9v83-76w9. Keep repository and CI SDK selection aligned so CoreCLR and NativeAOT builds use the patched runtime and compiler packs. This execution-toolchain pin does not update immutable inspection fixtures, package coordinates, or historical evidence; inspected assemblies remain unloaded.

Build the normal graph with:

dotnet build dotnet-inspect.slnx -c Release

The primary dependencies are the .NET SDK, Microsoft.CodeAnalysis.CSharp, and Markout. For a major dependency update, check all three and update the .NET SDK and Microsoft.CodeAnalysis.CSharp together.

Which dotnet-inspect to run

For routine repository development and investigation, use the latest production dotnet-inspect:

dnx dotnet-inspect -y -- <command>

The production tool is normally current and its Native AOT executable starts much faster than dotnet run. Prefer it for inspecting packages, platform libraries, local artifacts, and existing product behavior while developing.

Use the source version primarily to test behavior from the current worktree:

dotnet run --project src/DotnetInspect.Cli -c Release -- <command>

The source command is required when the evidence depends on an unmerged change, when reproducing or validating a source-only fix, or when checking output that the production release does not yet contain. Do not cite the production tool as evidence for worktree behavior, and do not pay the source-build startup cost for routine development queries that the production tool can answer.

Build warnings and dependency auditing

Warnings-as-errors is the repository default for normal builds and tests. A test may suppress a specific diagnostic only when its intended input cannot be produced with that diagnostic enabled; document the reason at the suppression. Prefer that narrow exception to disabling warnings-as-errors for a project.

NU1507 (multiple package sources without source mapping under central package management) stays enabled and is an error. Configure package-source mapping or use an explicit source for the restore; do not hide it with NoWarn.

NuGet Audit is different: vulnerability advisories can change without a source change. It is off for ordinary local, PR, and release builds. The separate nuget-audit-scheduled.yml workflow runs nightly at 05:37 UTC and supports manual reruns. It audits direct and transitive dependencies at every severity; findings fail that workflow rather than ci-required.

The audit restores the solution and the separately hosted Inspect Web tests, MSDL proxy tests, and IL round-trip tests, including each root's project references. It audits the tooling's restored dependencies, not the package contents acquired as inspection or corpus inputs. Standalone projects outside those restore graphs are not covered by this scheduled audit.

To reproduce one audit root locally:

dotnet restore dotnet-inspect.slnx --force-evaluate \
  -p:Configuration=Release -p:NuGetAudit=true \
  -p:NuGetAuditMode=all -p:NuGetAuditLevel=low

The root build properties own these defaults. Corpus scripts and test launchers inherit them instead of supplying their own warning or audit overrides.

Package acquisition when nuget.org is disabled

If a machine-level proxy lacks an exact pinned version and restore reports NU1603, do not edit machine configuration or commit a clearing nuget.config. Override sources for one restore:

dotnet restore dotnet-inspect.slnx -s https://api.nuget.org/v3/index.json

Prefer --source to --add-source; the package cache then satisfies later restores. Repeat after clearing the cache or changing to an uncached pin. Tool acquisition accepts the same override:

dotnet tool install -g dotnet-inspect --source https://api.nuget.org/v3/index.json
dnx dotnet-inspect --source https://api.nuget.org/v3/index.json

Additional library suites

CLI and product-output tests

Build the solution before running the CLI suite so its cataloged fixtures and out-of-process apphosts are current:

dotnet build dotnet-inspect.slnx -c Release
dotnet run --project tests/DotnetInspect.Cli.Tests -c Release

Debug-only CLI host contracts retain Release code generation while explicitly enabling their conditional surface:

dotnet run --project tests/DotnetInspect.Cli.Tests -c Release \
  -p:DefineConstants=DEBUG -- \
  --filter-class DotnetInspect.Cli.Tests.DependsAssetCommandTests

This is a Microsoft Testing Platform executable. Use --filter-class and --filter-method after -- for focused selections; PR CI excludes Speed=Slow, while Deep Inspect runs the complete suite. Compiler-produced sample types and self-host tests remain with the executable under tests/; independently compiled inspected inputs remain under fixtures/. See repository layout.

Inspect Web host tests

Run the managed Browser/Wasm host suite and the frontend suite from their respective repository roots:

dotnet run --project tests/DotnetInspect.Web.Tests -c Release
cd inspect-web
npm test
npm run lint

The WebAssembly host is part of the normal solution graph, but its default build compiles only managed code and does not invoke Node. Build the frontend first and pass -p:InspectWebIncludeFrontend=true for a complete browser build or publish; publishing without that explicit opt-in fails rather than producing an incomplete site. The managed and WebAssembly modes use isolated restore and artifact paths: Release outputs are under artifacts/*/DotnetInspect.Web/release and artifacts/*/DotnetInspect.Web/release_browser-wasm, respectively.

The managed suite is part of the normal solution graph and requires neither Node nor the WebAssembly workload. It is an xUnit Microsoft Testing Platform executable. Use --filter-class and --filter-method after -- for focused selections. It covers the DotnetInspect.Web host, shared Sections and Networking implementation, and domain-specific DotnetInspect.Web.Interop.* export assemblies. The frontend gates own the generated public facade contracts and browser application without renaming the published inspect-web-* modules.

Network tests

Run the owner suites from the repository root:

dotnet run --project tests/NetworkAccess.Tests -c Release
dotnet run --project tests/DotnetInspector.Networking.Tests -c Release

NetworkAccess.Tests pins the shared IPv4 and IPv6 destination classification used by independent desktop transports. DotnetInspector.Networking.Tests pins product HTTP composition, Browser/Wasm-safe handler setup, network policy, and request telemetry. The Cache suite pins cache behavior; the CLI suite owns combined request-diagram integration tests, and NuGetFetch retains NuGet transport and feed-failure tests.

Section-contract tests

Run the shared section-contract suite from the repository root:

dotnet run --project tests/DotnetInspector.Sections.Tests -c Release

This Microsoft Testing Platform executable owns semantic row shaping and the cross-host completed-inspection envelope, portable-share, contained-diagnostic, and JSON round-trip contracts.

Graph substrate tests

Run the domain-neutral graph carrier suite from the repository root:

dotnet run --project tests/Inspector.Graph.Tests -c Release

This Microsoft Testing Platform executable owns structural invariants, the independently compiled direct-consumer proof, and the project plus assembly dependency boundary.

Persistent-cache tests

Run the cache-owner suite from the repository root:

dotnet run --project tests/DotnetInspector.Cache.Tests -c Release

This Microsoft Testing Platform executable owns PersistentCacheTests for hashing, cache roots, expiry, and cleanup; CacheTelemetryTests for redaction and request/network context; and the moved CacheMaintenanceProgressTests, formerly in the Services suite.

Package coordination tests

Run the package-owner suite from the repository root:

dotnet run --project tests/DotnetInspector.Packages.Tests -c Release

This Microsoft Testing Platform executable owns AsyncCacheTests, formerly in the Services suite. AsyncCache is internal to DotnetInspector.Packages, and PackageExtractor is its sole production consumer. Broader integration tests remain with their existing CLI, DotnetInspector.Services, ILInspector.Metadata, and NuGetFetch owner suites.

Authored SourceHouse tests

Run the focused settlement suite from the repository root:

dotnet run --project tests/DotnetInspector.SourceHouse.Tests -c Release

This Microsoft Testing Platform executable covers exact Library and target correspondence, supplied-PDB authored source, ordered source capabilities, bounded settlement, and transferred-lease retirement. It uses real repository assembly/PDB/source inputs. Production CLI and Browser source-query adoption remains separately staged.

Untrusted-document tests

Run the independent parsing-owner suite from the repository root:

dotnet run --project tests/UntrustedDocuments.Tests -c Release

This Microsoft Testing Platform executable pins duplicate-property rejection, malformed JSON failure shape, XML DTD and external-entity rejection, explicit decoded-character budgets, and ordinary string, stream, and file parsing. The schema and semantic tests remain with their consuming owners.

Text-library tests

Run the complete text-library suites from the repository root:

dotnet run --project tests/InertText.Tests -c Release
dotnet run --project tests/Inspector.Text.Tests -c Release

Both are xUnit MTP executables. Their source lives under tests/, while their built outputs remain under artifacts/. The in-process corpus data stays with its test host; it is not an independently compiled inspected fixture. See repository layout.

Ecosystem tests

Run both the dedicated catalog suite and the separate public consumer suite:

dotnet run --project tests/DotnetInspector.Ecosystems.Tests -c Release
dotnet run --project tests/DotnetInspector.Ecosystems.Consumer.Tests -c Release

Both are xUnit in-process executables. Keep the consumer project separately compiled without friend access; only the dedicated catalog suite is an assembly friend. See the ecosystem boundary and package-set registry gates.

IL substrate and diff tests

Run the instruction-substrate and IL comparison suites:

dotnet run --project tests/ILInspector.Instructions.Tests -c Release
dotnet run --project tests/ILInspector.ILDiff.Tests -c Release

Both are xUnit in-process executables and retain separate assemblies and artifacts/ outputs. Their compiler-produced sample types stay with their test hosts; the ILDiff suite also retains its test-only Roslyn dependency for source inspection. See the instruction substrate and IL comparison boundary.

Model-bound C# tests

Run the C# formatting, declaration, and type-shell suite:

dotnet run --project tests/ILInspector.CSharp.Tests -c Release

This is an xUnit in-process executable with its built output under artifacts/. Its compiler-produced sample types stay with the test host, including the types inspected through its own assembly. Keep this suite distinct from the model-free tests/CSharpText.Tests suite. See repository layout.

Analysis tests

Build the solution before running the analysis suite so every FixtureCatalog binary is available, and always use Release because compiler-generated IL is part of the evidence:

dotnet build dotnet-inspect.slnx -c Release
dotnet run --project tests/ILInspector.Analysis.Tests -c Release

This is a Microsoft Testing Platform executable. Required PR lanes exclude Speed=Slow after --; Deep Inspect runs the complete suite. Compiler-produced runtime-async specimens remain inside the test assembly, while independently compiled analysis inputs remain under fixtures/analysis/. See repository layout.

Research tests

Build the solution before running the Research suite so every FixtureCatalog binary is available:

dotnet build dotnet-inspect.slnx -c Release
dotnet run --project tests/ILInspector.Research.Tests -c Release

This is a Microsoft Testing Platform executable. Use --filter-class and --filter-method after -- for focused selections. Its compiler-produced sample types stay with the host under tests/; independently compiled Research, analysis, and diff inputs remain under fixtures/. Deep Inspect adds --fail-skips on so platform certification cannot silently lose coverage. See repository layout.

Decompiler tests

Build the solution before running the decompiler suite so its cataloged fixture binaries and tool harness are current, and always use Release because the compiler-produced IL is test evidence:

dotnet build dotnet-inspect.slnx -c Release
source eng/activate-iltools.sh --mdv
dotnet run --project tests/ILInspector.Decompiler.Tests -c Release -- --gate no-corpus

The custom xUnit executable expands its --gate presets to MTP filters. Use --filter-class and --filter-method for focused selections. Its compiler-produced specimens stay with the host under tests/; independent inputs remain under fixtures/, and linked harness sources remain owned by tools/DecompilerHarness. Run the separate --gate corpus lane only when the multi-hour corpus sweep is required. See decompiler correctness and repository layout.

Inspection query tests

Build the solution before running the inspection-query suite so every FixtureCatalog binary is available:

dotnet build dotnet-inspect.slnx -c Release
dotnet run --project tests/DotnetInspector.Queries.Tests -c Release

This is a Microsoft Testing Platform executable. Use --filter-class and --filter-method after -- for focused selections. Its source and embedded resources live under tests/; the independently compiled binaries it inspects remain under fixtures/. See repository layout.

Shared services tests

Build the solution before running the shared-services suite so its route-learning FixtureCatalog binaries are available:

dotnet build dotnet-inspect.slnx -c Release
dotnet run --project tests/DotnetInspector.Services.Tests -c Release

This is a Microsoft Testing Platform executable. Use --filter-class and --filter-method after -- for focused selections. Its source lives under tests/; independently compiled route-learning inputs and static signed-package archives remain under fixtures/services/. See repository layout.

Test tooling activation

The CLI and decompiler suites skip ilasm/ildasm checks when those tools are missing; metadata tests do the same for mdv. Activate all three with source eng/activate-iltools.sh --mdv before relying on a clean run — source the wrapper rather than assembling PATH by hand. CI restores the same pinned tools and fails its lane if acquisition fails.

The IL round-trip project has separate dependency restore and fast/full test commands; follow tests/DotnetInspector.ILRoundtrip.Tests/README.md. ILInspector.Decompiler.Tests composes Speed and Area traits and offers a --gate <preset> flag (--gate list prints the table); the taxonomy and per-change targeting advice live in docs/decompiler-correctness-pipeline.md.

Only tool projects set IsPackable=true; IsTool also makes them available to solution-level publish. Internal library APIs are not external compatibility surfaces. Changing VersionPrefix is a coordinated package-and-site release: follow docs/release-workflow.md, publish dotnet-inspect and https://dotnet-inspect.net from the same commit, and update the shipped README.md and skills.

File-based apps

For throwaway probes, use .NET file-based apps under /tmp/ unless a specific Python library is required. Do not use .csx, dotnet-script, dotnet script, or dotnet-fsi.

dotnet run /tmp/check.cs