microsoft-performance-toolkit-sdk
Copilot instructions240 starsChanged 9 months agoMITView on GitHub
Repository Stats: - Languages: C# (.NET) - Project Type: Class library SDK with NuGet packages - Target Frameworks: .NET Standard 2.0, .NET Standard 2.1, .NET 6.0, .NET 8.0 - Solution: Single main solution at src/SDK.sln with 17+ projects - Size: Medium-sized repository with SDK core, runtime, engine, plugins system, tools, and comprehensive test coverage CRITICAL: Always run commands in the following order and configuration: Note: dotnet build without restore will auto-restore.
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
14 rules. About 0 are common, 8 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Always restore before building if you want --no-restore flag benefits
- Very specific: line 35
Configuration: Always use -c Release for production builds
- Distinctive: line 46
Filter: Only runs Unit, Integration, and Functional tests (not all tests are categorized)
- Very specific: line 47
Important: Use --no-build to run against already-built assemblies
- Very specific: line 102
Test Projects: All use .NET 8.0, named with .Tests suffix
- Very specific: line 156
WPA Compatibility: Check documentation/Known-SDK-Driver-Compatibility/WPA.md
- Distinctive: line 182
Test count may vary slightly (712-713) based on skipped tests
- Distinctive: line 183
All functional tests should pass.
- Distinctive: line 203
For new features: Consider if samples should be updated to demonstrate the feature
- Distinctive: line 215
Check you're in the correct directory context
- Distinctive: line 217
Only then perform additional investigation using grep/search tools
- Very specific: line 225
Use relative paths from the workspace root in commands (e.g., src/SDK.sln)
- Distinctive: line 227
Use PowerShell path syntax (backslashes or forward slashes both work)
- Distinctive: line 233
Don't manually edit version numbers in code
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Microsoft Performance Toolkit SDK - Copilot Instructions
Repository Overview
The Microsoft Performance Toolkit SDK is a cross-platform C# library that enables developers to create "SDK plugins" for processing and analyzing performance data from arbitrary data sources (ETL files, CTF files, SQL logs, CSV files, etc.). These plugins can be used by performance analysis applications like Windows Performance Analyzer (WPA).
Repository Stats:
- Languages: C# (.NET)
- Project Type: Class library SDK with NuGet packages
- Target Frameworks: .NET Standard 2.0, .NET Standard 2.1, .NET 6.0, .NET 8.0
- Solution: Single main solution at
src/SDK.slnwith 17+ projects - Size: Medium-sized repository with SDK core, runtime, engine, plugins system, tools, and comprehensive test coverage
Build and Test Instructions
Prerequisites
- .NET SDK 8.x (or compatible version that supports .NET Standard 2.0)
- Nerdbank.GitVersioning tool version 3.6.143 (automatically restored via NuGet)
- Windows OS (primary target platform, uses Windows-specific APIs in some areas)
Build Commands (VALIDATED - ALWAYS USE THESE)
CRITICAL: Always run commands in the following order and configuration:
- Restore Dependencies (Optional but recommended for clean builds):
dotnet restore "src/SDK.sln"- Can be skipped;
dotnet buildwill restore automatically - Always restore before building if you want
--no-restoreflag benefits
- Can be skipped;
- Build the Solution (REQUIRED):
dotnet build "src/SDK.sln" --no-restore -c Release- Configuration: Always use
-c Releasefor production builds - Expected Warnings:
- ~22 warnings about obsolete interfaces (IApplicationEnvironmentV2, IApplicationEnvironmentV3) - THESE ARE EXPECTED
- Build will succeed even with these warnings
- Without
--no-restore: Auto-restores first
- Configuration: Always use
- Run Tests (REQUIRED for validation):
dotnet test "src/SDK.sln" -c Release --filter "TestCategory~Unit|TestCategory~Integration|TestCategory~Functional" --no-build --verbosity normal- Expected Results: 712+ tests pass, 0-1 skipped, 0 failures
- Filter: Only runs Unit, Integration, and Functional tests (not all tests are categorized)
- Important: Use
--no-buildto run against already-built assemblies - Some test projects show warnings about no matching tests - THIS IS EXPECTED for PluginsSystem test projects
- Build Sample Projects (Optional validation):
Get-ChildItem "samples" -Filter *.sln -Recurse | ForEach-Object { dotnet build $_.FullName -c Release }- Builds
SimpleDataSource/SampleAddIn.slnandSqlPlugin/SqlPlugin.sln - Validates plugin development patterns
- Builds
Clean Build
To start fresh:
dotnet clean "src/SDK.sln"
dotnet build "src/SDK.sln" -c ReleaseNote: dotnet build without restore will auto-restore.
Project Structure and Key Files
Root Directory Structure
.github/ # CI/CD workflows and GitHub configuration
workflows/
ci.yml # PR validation: build + test + samples
main_build_status.yml # Main branch build status
main_tests_status.yml # Main branch test status
src/ # Main solution and all projects
SDK.sln # Primary solution file
Directory.Build.props # Shared MSBuild properties (Nerdbank.GitVersioning)
Directory.Build.targets # Shared MSBuild targets (test package versions)
version.json # Version configuration (Nerdbank.GitVersioning)
nuget.config # NuGet package source configuration
samples/ # Example SDK plugins
SimpleDataSource/ # Basic text file processing plugin
SqlPlugin/ # SQL trace file processing plugin
documentation/ # Comprehensive SDK usage documentation
Using-the-SDK/ # Plugin development guides
Architecture/ # SDK architecture deep-dives
devel-template/ # .NET template for creating SDK plugins (WIP)Key Projects in src/SDK.sln
Core SDK Libraries (Plugins depend on these):
Microsoft.Performance.SDK- Core SDK library (.NET Standard 2.0) - This is what plugins referenceMicrosoft.Performance.SDK.Runtime- Runtime for loading/processing plugins (.NET Standard 2.0) - Plugins should NOT depend on thisMicrosoft.Performance.SDK.Runtime.NetCoreApp- .NET Core specific runtime (multi-targeted: net6.0, net8.0)Microsoft.Performance.Toolkit.Engine- Programmatic interface for manipulating plugin data (.NET Standard 2.1)
Plugins System:
Microsoft.Performance.Toolkit.Plugins.Core- Core plugin system abstractions (.NET Standard 2.0)Microsoft.Performance.Toolkit.Plugins.Runtime- Plugin system runtime (.NET Standard 2.0)Microsoft.Performance.Toolkit.Plugins.Cli- CLI tool for plugin management (net8.0)
Test Projects: All use .NET 8.0, named with .Tests suffix
Tools:
PluginConfigurationEditor- GUI tool for editing plugin configuration (net8.0)
Configuration Files
src/version.json- Nerdbank.GitVersioning config, current version: "1.4-preview2"src/Directory.Build.props- Sets Nerdbank.GitVersioning 3.6.143 for all projectssrc/Directory.Build.targets- Centralizes test framework versions (MSTest 2.2.7, Microsoft.NET.Test.Sdk 16.11.0)src/nuget.config- Uses nuget.org as package source- No
.editorconfigor style enforcement files present
CI/CD Validation Pipeline
PR Validation (.github/workflows/ci.yml)
Triggers: On pull requests to main
Runs on: windows-latest
Steps:
- Checkout with full history (
fetch-depth: 0) - Setup .NET 8.x
- Setup Nerdbank.GitVersioning (nbgv) 3.6.143
dotnet restore "src/SDK.sln"dotnet build "src/SDK.sln" --no-restore -c Releasedotnet test "src/SDK.sln" -c Release --filter "TestCategory~Unit|TestCategory~Integration|TestCategory~Functional" --no-build --verbosity normal- Build all sample solutions:
ls "samples/**/*.sln" | % { dotnet build $_.FullName -c Release }
To replicate PR checks locally, run these commands in order:
dotnet restore "src/SDK.sln"
dotnet build "src/SDK.sln" --no-restore -c Release
dotnet test "src/SDK.sln" -c Release --filter "TestCategory~Unit|TestCategory~Integration|TestCategory~Functional" --no-build --verbosity normal
Get-ChildItem "samples" -Filter *.sln -Recurse | ForEach-Object { dotnet build $_.FullName -c Release }Main Branch Validation
- main_build_status.yml: Build-only validation
- main_tests_status.yml: Build + test validation (same as PR but on push to main)
Architecture and Development Patterns
Plugin Development Model
SDK plugins consist of:
- ProcessingSource - Entry point, advertises supported data sources
- CustomDataProcessor - Implements data processing logic
- Table(s) - Defines tabular data output
- DataCooker(s) (optional) - Enables data sharing between plugins via data-processing pipeline
Key Pattern: Plugins target .NET Standard 2.0/2.1 and reference Microsoft.Performance.SDK NuGet package only (NOT the Runtime).
Target Framework Guidelines
- SDK plugins: .NET Standard 2.0 or 2.1
- Core libraries: .NET Standard 2.0 (Microsoft.Performance.SDK) or 2.1 (Engine)
- Runtime: Multi-targeted: net6.0, net8.0
- Tests/Tools: .NET 8.0
- WPA Compatibility: Check
documentation/Known-SDK-Driver-Compatibility/WPA.md
Common Patterns in Codebase
- Obsolete warnings for IApplicationEnvironmentV2/V3 are expected (removal planned for v2.0)
- ProcessingSource constructor overloads have obsolete variants (use CreateTableProvider pattern)
- Some code has TODO comments for known future work (see grep results)
- Tests use MSTest framework with TestCategory attributes for filtering
Known Issues and Workarounds
Expected Build Warnings (NON-BLOCKING)
- CS0618 Obsolete Warnings (~15 warnings):
IApplicationEnvironmentV2andIApplicationEnvironmentV3interfaces marked obsoleteProcessingSourceconstructor overloads marked obsolete- Action: Ignore these; they're intentional for deprecation path to v2.0
- CS1574 XML Comment Warnings (~6 warnings):
- cref attributes that couldn't be resolved (e.g., 'PluginOption')
- Action: Ignore; documentation generation still works
- CS1685 Predefined Type Warning (1 warning in Runtime.Tests):
- ExtensionAttribute defined in multiple assemblies
- Action: Ignore; compiler picks correct definition
Test Execution Notes
- Some test projects (PluginsSystem tests) may show "No test matches filter" warnings - this is expected as not all tests are categorized
- Test count may vary slightly (712-713) based on skipped tests
- All functional tests should pass; failures indicate real issues
Code Changes and Testing Workflow
Making Code Changes
- Before editing: Understand if you're working on:
- SDK core library (plugins depend on this - breaking changes affect consumers)
- Runtime (internal to SDK drivers)
- Plugin system (affects plugin loading/management)
- Samples (demonstrates patterns)
- After making changes:
# Build and immediately test dotnet build "src/SDK.sln" -c Release dotnet test "src/SDK.sln" -c Release --filter "TestCategory~Unit|TestCategory~Integration|TestCategory~Functional" --no-build --verbosity normal - For SDK API changes: Also validate samples build successfully
- For new features: Consider if samples should be updated to demonstrate the feature
Debugging Plugins
- Plugins are debugged using Windows Performance Analyzer (WPA)
- WPA launch arguments:
-nodefault -addsearchdir <plugin_bin_directory> - See
documentation/Using-the-SDK/Creating-your-plugin.mdfor Visual Studio debug setup
Important Guidelines
Trust These Instructions
These instructions have been validated by running actual builds and tests. If you encounter issues:
- First, verify you're using the exact commands as specified
- Check you're in the correct directory context
- Confirm .NET SDK version compatibility
- Only then perform additional investigation using grep/search tools
When to Search vs. Use Instructions
- Use instructions for: Building, testing, understanding project structure, CI validation
- Search/explore when: Implementing new features, finding specific APIs, understanding complex logic, locating related code
- Common pitfall: Over-searching instead of following validated build steps
File Path Conventions
- Use relative paths from the workspace root in commands (e.g.,
src/SDK.sln) - Paths with spaces should be quoted
- Use PowerShell path syntax (backslashes or forward slashes both work)
Version Management
- Version controlled by Nerdbank.GitVersioning (NBGV)
- Version is auto-generated from git history +
version.json - Current preview version: 1.4-preview2
- Don't manually edit version numbers in code
Additional Resources
- Architecture Overview:
documentation/Architecture/README.md - Plugin Creation Guide:
documentation/Using-the-SDK/Creating-your-plugin.md - Simple Plugin Tutorial:
documentation/Using-the-SDK/Creating-a-simple-sdk-plugin.md - Troubleshooting:
documentation/Troubleshooting.md - Sample Code:
samples/SimpleDataSource/andsamples/SqlPlugin/ - Contributing:
CONTRIBUTING.md(requires CLA for external contributors)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

