Skip to content

[ReferenceTrimmerUseSymbolAnalysis] Account for constructor overrides #146

@olstakh

Description

@olstakh

Small repository with a clear repro: https://github.com/olstakh/RT_Gap_Inheritance

ProviderDependency project:

namespace ProviderDependency;
public class Class1 {}

Provider project:

namespace Provider;
public class Class1
{
    public Class1(params string[] x)
    {
    }
    public Class1(ProviderDependency.Class1 attribute) // Optional public constructor, taking the external type
    {
    }
}

Consumer project:

public class Class1 : Provider.Class1
{
    public Class1() : base("1") // Error if ProviderDependency project is not referenced
    {     
    }
}

Currently, in version 3.5.6 - RT doesn't recognize that ProviderDependency project can't be trimmed











P. S. Same thing with the attributes.

namespace Provider;

[AttributeUsage(AttributeTargets.Class)]
public sealed class Attribute1 : Attribute
{
    public Attribute1(params string[] x)
    {
    }
    public Attribute1(ProviderDependency.Class1 attribute)
    {
    }
}

and

[Provider.Attribute1("1")] // Error if ProviderDependency project is not referenced
public class Class2
{   
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions