Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API incompatibility between target frameworks #50

Closed
huoyaoyuan opened this issue Oct 8, 2024 · 0 comments
Closed

API incompatibility between target frameworks #50

huoyaoyuan opened this issue Oct 8, 2024 · 0 comments

Comments

@huoyaoyuan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants