dotnet / dotnet/roslyn

Consider exposing operation block for default constructor

Open
#79,581 2 comments 0 reactions 0 assignees View on GitHub
Area-Compilers Feature - IOperation untriaged
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

The trim analyzer has a scenario where we would like to produce a warning for the default constructor's implicit call to the base constructor. Our analyzer works with operation blocks, so it would be convenient if there were a callback for the implicit default constructor operation block.

We can work around this by using the symbol APIs, but I wonder if it would make sense to expose the default ctor via operation APIs.

Note that if I write out a parameterless constructor in source, this does surface as an operation block (which includes the implicit call to the base constructor). The ask is just for an implicit parameterless constructor to behave the same.

See https://github.com/dotnet/runtime/issues/106796 for context.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.