Skip to content

API incompatibility between target frameworks #50

Closed
@huoyaoyuan

Description

@huoyaoyuan

The definition of CloneFileAsync is different for target frameworks:

#if NET6_0 || NETSTANDARD2_1
ValueTask
#elif NETSTANDARD2_0
Task
#else
#error Target Framework not supported
#endif
CloneFileAsync(string source, string destination, CloneFlags cloneFlags, CancellationToken cancellationToken);

The NuGet mechanism requires the API for higher framework being strict superset of lower framework. See more at https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/package-validation/compatible-framework-in-package-validator .

In short, the assembly used for run time will be picked by the framework of entry project, but for compile time it will be picked by current project. Such incompatibility will cause MissingMethodException when using in a transitive project targeting netstandard2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions