-
Notifications
You must be signed in to change notification settings - Fork 516
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
Toolchain prefers buildin facade SDKs over NuGet packages depending on RestoreProjectStyle #8028
Comments
Hi, Does anyone have a fix or workaround for this issue? I'm having the same issue with a nuget referencing System.IO.Abstractions. I'm getting the same error where the following method is missing : FileSystemAclExtensions::Create(DirectoryInfo,DirectorySecurity) Thank you |
I'm able to workaround this issue by using the old |
Thanks for the workaround, but in my case I seem to have way more trouble using packages.config instead of PackageReference... but it's not related to this issue. To add more information to this issue: |
I am having the exact same problem and I could solve it by downgrading the package that was using it to the version that was using System.IO.FileSystem.AccessControl to version 4.6.0 instead of 4.7.0 |
I was using System.IO.Abstractions v12.0.5 which had an implicit dependency on System.IO.FileSystem.AccessControl v4.70. I had to drop System.IO.Abstractions all the way back to v7.0.7 before it would build on iOS, but then my unit tests which were using that version started failing with
I had to fiddle with it, but |
Hey @rolfbjarne @spouliot. I am the maintainer of the mentioned package |
The problem seems to be that the library project's restore style is package reference, while the main project's restore style is not set, and there are no actual package references in the main project, only a project reference to the library project. Package references don't flow through project references, which means the main project's restore style is the old-style packages.config, and things end up confused. I found two workarounds in the example project in the original description:
I'm closing this since it seems this is not a bug in Xamarin.iOS, just a side effect of unintentionally using two different restore styles. Feel free to reopen if it's still possible to reproduce this with any of those workarounds (and please attach a test project as well). |
@rolfbjarne I can still reproduce this here: https://github.com/Cheesebaron/sys-io-abstraction-build-fail |
This was fixed in 8ecc47d. The fix wasn't intentional, but here's what happened:
Unfortunately this is a very recent fix, which means it's not in the current stable, nor in the preview. We're also fairly late in the release schedule for the upcoming release, and the fix has already proven to contain surprises, so I'm not comfortable with backporting the fix to the current preview. This means this will be fixed in the next main release ( If anybody wants to try the fix, they can grab a package from our |
Whilst it does not adversely effect my application, it produces a warning once the app has been built.
I tried both suggestions that you recommended @rolfbjarne :
I also played about adding these references to the iOS project to see if the error went away and no success. I would really like to get rid of this warning, and I don't particularly want to revert the implementation of my File Access class, which was the reason why I installed I'm fully up to date with XCode, Xamarin.iOS, Xamarin.Mac & Visual Studio for Mac:
Do you have any suggestions for resolving this issue? |
If you just want to silence the warning, you can add |
Looks like the issue is more serious as the app can't be built for release, won't be able to sweep the warning under the rug unfortunately 😔
For now I can sidestep the issue by doing what is suggested in the Do you know the eta for |
@Axemasta it will be a while until That being said, it would be nice if you could test a package locally, at least to make sure the fix works, because if it's a different issue and we only discover this when Here is a recent package from our |
@rolfbjarne I've installed the version of Xamarin.iOS that you linked, I can confirm there are no warnings or errors build associated with the loading of Interestingly there are 2 new warnings, coming from the System.Buffers.dll
System.Security.SecureString.dll
Specifying the package restore in the csproj does not appear to make a difference:
Nor does adding an explicit package reference:
The problem appears to be solved for the library I wanted to use Side thank-you for explaining what I needed to do to update to the preview version, it always scares me going to previews but it was very easy! I'm now back in the safety of the stable channel 😎 |
Steps to Reproduce
SdkOnly
.RestoreProjectStyle
toPackageReference
System.IO.FileSystem.AccessControl
nuget in both projectsFileSystemAclExtensions.Create
extension method forDirectoryInfo
like so:Why am I trying to include this extension method? I'm not directly doing that but other libraries like
System.IO.Abstractions
do.Additionally the same setup works for Android just fine.
Expected Behavior
The project should compile just fine.
Actual Behavior
The compilation fails with this error:
Additional Information
When building my real project I also get the following warning in the build log but not for the example project. Not sure what's the reason for that.
As one can see in the build logs the
System.IO.FileSystem.AccessControl.dll
is included twice: Once from the nuget package and than again from the SDK facades from/Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.17/lib/mono/Xamarin.iOS/Facades/System.IO.FileSystem.AccessControl.dll
. The later does not include theFileSystemAclExtensions::Create(DirectoryInfo,DirectorySecurity)
extension method.The project does compile if
RestoreProjectStyle
is not set toPackageReference
and the nuget package is referenced using the olderReference
element with theHintPath
. The warning changes to the following:In this case the toolchain prefers the nuget package over the SDKs facade.
Is it possible to include the
FileSystemAclExtensions
in the shipped facade dll so thatRestoreProjectStyle=PackageReference
is possible? Or make some project settings so that the toolchain prefers the nuget version over the shipped facade dll? Or can I instruct the linker to completely remove all calls to the non-existing extension method, which would work in my special case?Environment
Build Logs
https://gist.github.com/MKuckert/5f09017d4d8a6fc20501e0cabe6ddaab
Example Project
Solution.zip
The text was updated successfully, but these errors were encountered: