-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
NuGet PackageReference style incorrectly selects 'bait' dll in NuGet package using 'bait and switch' pattern #2776
Comments
I'm seeing this as well, seems to be related to this issue Android 7.1 project using project.json chooses netstandard-1.6 dependencies, over monoandroid #5759 |
Has anyone had a chance to take a look at this? We have encountered this issue several times now in different applications. |
@kzu could you take a look?
From: kelly987654
Sent: Friday, January 12, 2018 7:14 PM
To: Microsoft/msbuild
Cc: Subscribed
Subject: Re: [Microsoft/msbuild] NuGet PackageReference style incorrectlyselects 'bait' dll in NuGet package using 'bait and switch' pattern (#2776)
Has anyone had a chance to take a look at this? We have encountered this issue several times now in different applications.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I've no idea where to even start looking @dsplaisted :(. Wouldn't this be a NuGet restore issue rather? |
@kzu Yes, it sounds like something NuGet related, but I haven't heard of this issue before, so I think it might be specific to Xamarin projects. |
/cc @mhutch
On Mon, Jan 15, 2018 at 9:03 PM Daniel Plaisted ***@***.***> wrote:
@kzu <https://github.com/kzu> Yes, it sounds like something NuGet
related, but I haven't heard of this issue before, so I think it might be
specific to Xamarin projects.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2776 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKW60TZyPQKpgirQYGyFyVgAnInL1Jdks5tK-c_gaJpZM4Q2zcG>
.
--
…--
/kzu from mobile
|
The NuGet has implementation assemblies for Android, but the reference assembles are NetStandard. "compile": {
"ref/netstandard1.0/ISocketLite.PCL.dll": {},
"ref/netstandard1.0/SocketLite.dll": {}
},
"runtime": {
"lib/MonoAndroid10/ISocketLite.PCL.dll": {},
"lib/MonoAndroid10/SocketLite.dll": {}
} Xamarin.Android packaging (and resource extraction) steps appear to be picking up the reference assemblies instead of the implementation assemblies. /cc @dellis1972 @jonpryor |
This is related to dotnet/android#1154 and dotnet/android#1162 My investigation however shows that the |
Okay thanks for looking into this! So you think it is an msbuild issue? |
It seems this issue is affecting lot of Nuget libraries, even in Xamarin iOS. Any workaround? |
The only work around I can think of for now is to directly reference the @radical I think this is related to dotnet/android#1154 and dotnet/android#1162. Looks like it effects iOS too. |
My current "workaround" is to change the Android project to use packages.config instead. I tried directly referencing the lib from the Android project, and I was getting compilation errors. |
I'm trying to update my Library https://github.com/muhaym/CrossPlacePicker, and can't test it in Android because of this issue |
I recently updated my Android project, which was already using PackageReference successfully, to update all of the 3rd party dependencies, which also required updating my target from MonoAndroid71 to MonoAndroid80. One of the dependencies is ReactiveUI 8.0.0-alpha0117, which uses the bait and switch pattern. Everything initially worked, however I later needed to back date to MonoAndroid71 after which I started getting the following error from ReactiveUI: "You are referencing the Portable version of ReactiveUI in an App. Reference the platform-specific version." I verified that going back to MonoAndroid80 resolves the issue. I'm going to put my update on hold, but can anybody here with more information on the issue explain why I might be seeing this with MonoAndroid71 and not with MonoAndroid80? |
Is there any update on this? |
Related to this: dotnet/android#1154 and dotnet/android#1162 |
any update? This also blocks me |
@dellis1972 I think there was a fix for this, right? |
@kzu I "fixed" it by using packages.config instead of PackageReference |
We merged a fix for our |
what is the status of the issue? |
Starting a few weeks ago, Microsot.Identity.Client uses bait and switch and customers have started reporting issues. What is the status of this issue? |
We've started to see this issue using the latest version of Microsoft.Identity.Client (2.7.0) in our Xamarin android app when building remotely, everything seems fine when building locally. Are there updates on this? |
It seems like this same issues comes up using Going into Nuget packages and replacing
So maybe it's different in Xamarin or something has shifted (or maybe I just looked the output too hastily and it was a different project, it's Sunday and this is more work related. :)). If someone knows of the cuff the right target/changes, that'd be nice. Hopefully I dropped enough key words for search engine fu too to those who come from another angle. :) |
FYI, I don't know if something like this would better
Or perhaps
but they don't work. The first one print an error
And the reason appears to be that the |
This is still an issue for Microsoft.Identity.Client (4.1.0) in our Xamarin android app when building remotely, everything seems fine when building locally. Are there updates on this? |
Closing in favor of the Xamarin issues (which may now be fixed? Not totally clear to me at the moment.) |
For VS2017, the issue is still present, but even worse, I get issues about System.Threading.Tasks.Extensions. For VS2019, the Xamarin Team, made a lot of changes compared to 15.9 but with VS2019 the compile also randomly fails with useless messages about missing files (from used nugets). I gave it up on both (VS2017, VS2019) using PackageReference Include and always use the packages.config, which always works fine. |
Summary
A Xamarin.Forms project using a NetStandard class library for the Portable code, and the PackageReference NuGet package style in the corresponding Android project, incorrectly selects the 'bait' dll within a referenced 'Bait and Switch'-style NuGet package when compiling the Android App, resulting in a 'method or operation not implemented' exception on starting the App.
Note: The same project correctly compiles the Android-specific 'Switch' dll when using the packages.config NuGet style in the Android project.
Steps to reproduce
Sample projects
The below sample projects use SocketLite.PCL as an example package using the Bait-and-Switch pattern.
The below project uses the packages.config style in the Android project, and correctly compiles the Android-specific SocketLite.dll
BaitAndSwitchSample.zip
The below project is identical, but uses the PackageReference style in the Android project, and incorrectly compiles the 'bait' dll instead of the Android-specific SocketLite.dll. This project catches and displays the 'unimplemented method' exception.
BaitAndSwitchSample-X.zip
Environment data
Visual Studio Version 15.4.4
The text was updated successfully, but these errors were encountered: