Skip to content

What's the purpose of adding TypeForwardedTo attributes? #90

@0xced

Description

@0xced

In #86 you said

generate type forwards to ensure things work as expected in multi-targeting scenarios

Could you please elaborate a little bit more on this? What exact problem does it solve to add TypeForwardedTo attributes in target frameworks where the type exists?

For example, when multi-targeting net7.0;net6.0;netstandard2.0 the source generator produces this for .NET 6 and .NET 7 targets:

[assembly: global::System.Runtime.CompilerServices.TypeForwardedTo(typeof(global::System.Runtime.CompilerServices.IsExternalInit))]

If I add <PolySharpExcludeTypeForwardedToDeclarations>true</PolySharpExcludeTypeForwardedToDeclarations> they are not generated and everything seems to work fine. Am I missing something?

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