Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(csharp): align builtin_parents with shared .NET BCL set (#2309)

Erol Tascif57476ab8c12
diff --git a/packages/core/src/repowise/core/ingestion/languages/specs/csharp.py b/packages/core/src/repowise/core/ingestion/languages/specs/csharp.py
index ec8e402e4..0d5c4b657 100644
--- a/packages/core/src/repowise/core/ingestion/languages/specs/csharp.py
+++ b/packages/core/src/repowise/core/ingestion/languages/specs/csharp.py
@@ -94,6 +94,21 @@ SPEC = LanguageSpec(
"IComparable",
"ICloneable",
"IEquatable",
+ # UI and component base classes matching the VB.NET shared BCL set.
+ "Form",
+ "Control",
+ "UserControl",
+ "Component",
+ "Page",
+ "Window",
+ "Attribute",
+ "EventArgs",
+ "MarshalByRefObject",
+ "INotifyPropertyChanged",
+ "IComparer",
+ "ICollection",
+ "IList",
+ "IDictionary",
}
),
# Type expressions that never resolve to a user-defined .NET type. Skipping
diff --git a/tests/unit/ingestion/test_csharp_extractors.py b/tests/unit/ingestion/test_csharp_extractors.py
index 42ba2796d..1761a9d4c 100644
--- a/tests/unit/ingestion/test_csharp_extractors.py
+++ b/tests/unit/ingestion/test_csharp_extractors.py
@@ -101,6 +101,27 @@ public class Repo : Microsoft.EntityFrameworkCore.DbContext, IRepository<User>
assert "DbContext" in names
assert "IRepository" in names
+ def test_builtin_bcl_parents_filtered(self, parser: ASTParser) -> None:
+ src = b"""\
+namespace App;
+public class CustomEventArgs : EventArgs {}
+public class CustomAttribute : Attribute {}
+public class MainForm : Form {}
+public class CustomControl : Control {}
+public class Entity : MarshalByRefObject, IDisposable, INotifyPropertyChanged {}
+"""
+ result = parser.parse_file(_file(), src)
+ names = {r.parent_name for r in result.heritage}
+ assert "EventArgs" not in names
+ assert "Attribute" not in names
+ assert "Form" not in names
+ assert "Control" not in names
+ assert "MarshalByRefObject" not in names
+ assert "IDisposable" not in names
+ assert "INotifyPropertyChanged" not in names
+ assert len(result.heritage) == 0
+
+
# ---------------------------------------------------------------------------
# Bindings