A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
This report presents the forensic synthetic code analysis of microsoft/CsWin32, a C# project with 2,507 GitHub stars. SynthScan v2.0 examined 34,885 lines of code across 250 source files, recording 49 pattern matches distributed across 5 syntactic categories. The overall adjusted score of 4.2 places this repository in the Likely human-written band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 49 distinct pattern matches across 5 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. 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 diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| 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 |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | …Microsoft.Windows.CsWin32.Tests/FullGenerationTests.cs | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. | COMMENT |
| LOW | test/Microsoft.Windows.CsWin32.Tests/COMTests.cs | 921 | /// <summary> | COMMENT |
| LOW | azure-pipelines/build.yml | 1 | parameters: | 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/CsWin32Generator/Program.cs | 201 | { | 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/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/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 | public record FriendlyOverloadOptions | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.InlineArrays.cs | 161 | else | COMMENT |
| LOW | …crosoft.Windows.CsWin32/Generator.FriendlyOverloads.cs | 1581 | private MethodDeclarationSyntax? DeclareStructCountOfBytesFriendlyOverload(MethodDeclarationSyntax externMethodDecla | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 101 | ".Replace("\r\n", "\n"); | COMMENT |
| LOW | src/Microsoft.Windows.CsWin32/Generator.Invariants.cs | 301 | /// <summary> | 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/templates/NTSTATUS.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 | 94 | // This code was generated by a tool. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | src/Microsoft.Windows.CsWin32/Generator.Com.cs | 1189 | // 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 | 1378 | // 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 |