Skip to content

Symbol API exposes data that can be mutated by the caller #26328

@CyrusNajmabadi

Description

@CyrusNajmabadi

Found while working on: #26325

Right now the symbol model has IEnumerable<string> INamedTypeSymbo.MemberNames { get; }. However, both the VB and C# implementations implement that member with a simple string[] that is passed directly out to the caller. This means the caller can trivially cast this to the real type and mutate the array, corrupting the internal data of the compiler.

This returned value needs to be a true immutable value that cannot be changed by the caller in order to preserve hte important immutability invariants of the compiler API.

Metadata

Metadata

Labels

Area-CompilersBugConcept-APIThis issue involves adding, removing, clarification, or modification of an API.Concept-Design DebtEngineering Debt, Design Debt, or poor product code quality

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions