A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
This report summarizes scanner evidence for microsoft/CsWin32, a C# project with 2,526 GitHub stars. SynthScan examined 40,154 lines of code across 274 source files, recording 64 pattern matches distributed across 5 syntactic categories. The legacy adjusted pattern signal is 4.2 (Low pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Payload schema: 1.0.0 · Engine: 2.0.0 · Scoring: heuristic-density-v1 · Scan date: 2026-10-31.
Can maintainers explain intent, assumptions, and trade-offs? 57 finding(s).
Are imports declared and package/API names verified? 7 finding(s).
Are wrappers, guards, and repeated structures necessary? 0 finding(s).
Which changes need focused human review? 64 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 64 distinct pattern matches across 5 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL⚡ | src/Microsoft.Windows.CsWin32/BannedSymbols.txt | 34 | M:Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax.AddBaseListTypes(Microsoft.CodeAnalysis.CSharp.Syntax.Base | CODE |
| CRITICAL⚡ | src/Microsoft.Windows.CsWin32/BannedSymbols.txt | 35 | M:Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax.AddBaseListTypes(Microsoft.CodeAnalysis.CSharp.Syntax. | CODE |
| CRITICAL⚡ | src/Microsoft.Windows.CsWin32/BannedSymbols.txt | 36 | M:Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax.AddBaseListTypes(Microsoft.CodeAnalysis.CSharp.Syntax.Bas | CODE |
| CRITICAL⚡ | src/Microsoft.Windows.CsWin32/BannedSymbols.txt | 37 | M:Microsoft.CodeAnalysis.CSharp.Syntax.EnumDeclarationSyntax.AddBaseListTypes(Microsoft.CodeAnalysis.CSharp.Syntax.BaseT | CODE |
| CRITICAL⚡ | src/Microsoft.Windows.CsWin32/BannedSymbols.txt | 38 | M:Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.AddAccessorListAccessors(Microsoft.CodeAnalysis.CSharp. | CODE |
| CRITICAL⚡ | src/Microsoft.Windows.CsWin32/BannedSymbols.txt | 39 | M:Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax.AddArgumentListArguments(Microsoft.CodeAnalysis.CSharp | CODE |
| CRITICAL | …Microsoft.Windows.CsWin32/Generator.SafeHandleLease.cs | 67 | && handle.Generator.MetadataIndex.MetadataByNamespace.Values.Count(metadata => metadata.Types.ContainsKey(na | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | …Microsoft.Windows.CsWin32.Tests/FullGenerationTests.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | …icrosoft.Windows.CsWin32.Tests/InteriorPointerTests.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | …/Microsoft.Windows.CsWin32.Tests/MultiMetadataTests.cs | 41 | Assert.Contains(this.FindGeneratedType("RtlUnsubscribeWnfStateChangeNotificationSafeHandle"), static type => typ | COMMENT |
| LOW | test/GenerationSandbox.Tests/HandleOwnershipTests.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | test/GenerationSandbox.Tests/HandleOwnershipTests.cs | 21 | /// </para> | COMMENT |
| LOW | test/GenerationSandbox.Tests/SignExtendedHandleTests.cs | 21 | /// <c>GetCurrentThread</c> (-2) pseudo-handles, and 32-bit GDI/USER handles that are sign-extended to 64 bits. | COMMENT |
| LOW | azure-pipelines/build.yml | 1 | parameters: | COMMENT |
| LOW | integration-tests/sdk-roslyn5/app/Program.cs | 1 | // This test verifies that the Roslyn 5.0 analyzer leg is loaded and the | COMMENT |
| LOW | integration-tests/nonsdk/Properties/AssemblyInfo.cs | 21 | COMMENT | |
| LOW | …Windows.CsWin32.BuildTasks/CsWin32CodeGeneratorTask.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | …Windows.CsWin32.BuildTasks/CsWin32CodeGeneratorTask.cs | 61 | /// Gets or sets the semicolon-separated paths to Windows metadata files (.winmd). | COMMENT |
| LOW | …Windows.CsWin32.BuildTasks/CsWin32CodeGeneratorTask.cs | 81 | COMMENT | |
| LOW | …Windows.CsWin32.BuildTasks/CsWin32CodeGeneratorTask.cs | 101 | COMMENT | |
| LOW | src/Microsoft.Windows.CsWin32/MetadataIndex.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/MetadataIndex.cs | 41 | /// </summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.Constant.cs | 481 | } | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/IGenerator.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/IGenerator.cs | 21 | /// Collects the result of code generation. | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/IGenerator.cs | 41 | /// <summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/IGenerator.cs | 61 | /// <summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/SourceGenerator.cs | 281 | // Validate the ExtensionReceiver option (if set). On the Roslyn 5 leg, validation runs per-Generator: | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 21 | COMMENT | |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 41 | COMMENT | |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 61 | public FriendlyOverloadOptions FriendlyOverloads { get; set; } = new(); | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 81 | /// </para> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 121 | COMMENT | |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 141 | /// <remarks> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/GeneratorOptions.cs | 161 | /// Gets or sets a value indicating whether to also generate overloads that use pointer types for parameters tha | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs | 161 | else | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 121 | private static readonly string PartialPInvokeMacrosContentComment = @" | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 141 | private static readonly SyntaxTriviaList InlineCharArrayToStringComment = ParseLeadingTrivia(@"/// <summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 321 | isActive: true))); | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.cs | 221 | /// </summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.cs | 241 | /// </summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.cs | 261 | /// </summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.cs | 1381 | newName = methodName.Substring(0, methodName.Length - 1); | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.cs | 1621 | /// </summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.cs | 1821 | } | COMMENT |
| LOW | ….Windows.CsWin32/templates/NativeOwnershipAttribute.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | …Microsoft.Windows.CsWin32/templates/SafeHandleLease.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/templates/NTSTATUS.cs | 1 | /// <summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/templates/ComOutPtr.cs | 1 | /// <summary> | COMMENT |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 1 | /// <summary> | COMMENT |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 21 | /// <returns>A 32-bit unsigned integer.</returns> | COMMENT |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 41 | /// Constructs a <see cref="global::Windows.Win32.Foundation.LRESULT"/> from two 16-bit values. | COMMENT |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 61 | COMMENT | |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 81 | COMMENT | |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 101 | /// </summary> | COMMENT |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 121 | /// </summary> | COMMENT |
| LOW | …rosoft.Windows.CsWin32/templates/PInvokeClassMacros.cs | 141 | /// </summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/templates/HRESULT.cs | 1 | /// <summary> | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/templates/HRESULT.cs | 21 | /// second severity bit. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 106 | // This code was generated by a tool. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | src/Microsoft.Windows.CsWin32/Generator.Com.cs | 1202 | // We leverage C# syntax that we know the modern C# compiler will turn into a pointer directly into | COMMENT |
| MEDIUM | src/Microsoft.Windows.CsWin32/Generator.cs | 1429 | // We don't (yet) generate code to leverage aliases, so we skip any symbols defined in aliased refer | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | azure-pipelines/build.yml | 4 | ##### Feel free to adjust their default value as needed. | COMMENT |