C#: extension fallback binds an instance call to an incompatible extension method #397
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#397
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Confirmed on the signed, shipped runtime v0.41.1 (
419f349b) with the published C# 0.1.5 package (sha256:cc393ce325dabec0ad21b68716194e84e48e2cfc88dfed68f3b8aad12f79885c). Project ownership was checked aspackage/de.h-dv.csharp; the tested CIP is byte-identical to the published CIP.Minimal fixture, with each declaration in its own file:
Compiler oracle: .NET SDK 9.0.118, offline restore with no package sources, compiled the three files plus
System.Console.WriteLine(App.UseWidget.Run());and printedwidget. The instance method is the target; the extension'sthis stringparameter is incompatible withWidget.Observed index result: after indexing with the package enabled and
csharp = "package",search_symbolsfindsUseWidget.Run.find_calleesreturns theDescribecall asresolution: resolved,resolved_by: csharp_extension,qualifier: widget, targeting App.TextExtensions.Describe. It reports one resolved call and zero unresolved calls. The correct App.Widget.Describe declaration is present in the same index.The reproduction lives in
/tmp/cosi-csharp-call-baseline/(extension-callees.json,extension-ownership.json) and the compiler oracle in/tmp/cosi-csharp-extension-oracle/(run.log,index-targets.json) on the build machine. The inline fixture is sufficient to recreate it elsewhere.The
Tier EXTpass incrates/indexer/src/index.rsadmits a unique reachable extension candidate without proving receiver compatibility. When the ordinary receiver-origin pass cannot resolve this instance call, that fallback creates a wrong edge.Acceptance:
stringreceiver positive control for the extension and namespace/project/overload decoys, including deletion/restoration.Related: #313 requests extension recall for unknown receivers and explicitly requires no wrong binds. This is a precision blocker for advertising the C# plugin as fully production ready.
A capability control was also run on the same fixture with the shipped v0.41.1 runtime and published C# 0.1.5:
extension_methods, then runcode-index index.find_callees(..., include_unresolved=true)retains the extractedDescribecall withtarget_id: null/resolution: unresolved. Ownership remainspackage, andextraction_grant_refusals.filesis 0.--grant requested, reindex, and the wrongcsharp_extensionbind returns.extension_methodsagain and reindex: the wrong edge clears again.The tested subset was
same_file_candidate,exported_candidate,reachability_anchor,qualified_candidate,type_position_candidate,member_candidate. This is a mitigation for the false extension edge; it does not resolve the correct instance target. Logs areextension-grant-*,extension-callees-*andextension-ownership-*in the reproduction directory. Watcher transport was not tested by this control.buildagent referenced this issue2026-10-22 18:25:41 +02:00