Skip to content

Marshalling source generation code could pass TypePositionInfo and StubCodeContext only to constructors and have parameterless generation methods #89033

@jtschuster

Description

@jtschuster

The marshalling generator types in Microsoft.Interop.SourceGeneration pass a StubCodeContext to a method that builds an IMarshallingGenerator, which takes a TypePositionInfo and StubCodeContext each time it generates a method, and has different behavior depending on those.

If instead, a constructor method composed an object based on the StubCodeContext and TypePositionInfo, and the methods on the object took no parameters, the generator could be much easier to debug and unit test, as the composition of the object would be the only thing that impacts the generated code. This would also make it easy to unit test, since tests could compose an object and test the behavior of the generator without need to create a TypePositionInfo and StubCodeContext.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Runtime.InteropServicesin-prThere is an active PR which will close this issue when it is mergedsource-generatorIndicates an issue with a source generator feature

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions