-
Notifications
You must be signed in to change notification settings - Fork 5k
HttpClient 4.3.2 broken on Mono #21777
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
Comments
@marek-safar @ericstj any insight here? |
Shouldn't have affected it |
All versions of System.Net.Http are broken on Mono because they use private API available in .NET assemblies only (bad InternalsVisibleTo). To workaround that Mono has a hack to disable loading such assemblies and use always Mono's ones. You can simply fix it by deleting System.Net.Http.dll from your bin folder or wait for Mono 5.2 with updated table of broken assemblies. @ericstj this is again issue we reported months ago as https://github.com/dotnet/corefx/issues/15112 which you marked as fixed but the assembly does not have your fix. Could you please re-address the issue. |
@marek-safar the fix for https://github.com/dotnet/corefx/issues/15112 has not yet been released. That is part of the .NET Core 2.0 release. Package 4.3.2 is a servicing release for .NET Core 1.1. |
Do we need to backport it? Or should we just wait for 2.0 to ship? @mj1856 can you please validate it on .NET Core 2.0 Preview 1 bits? We want to confirm the problem is gone ... |
I see. I had no idea .NET framework specific issue is part of .NET Core 2.0 release. |
It's a package related issue and the packages ship with .NET Core. I do think there is an interesting pivot here. Many of the packages which you care about do not ship in 2.0, instead we are shipping the NETStandard.Library.NETFramework package and deprecating the standalone packages. |
@karelz - I tried the latest |
@mj1856 we no longer produce this package as I mentioned above. You can use the NETStandard.Library.NETFramework package in its place. |
@marek-safar - just to confirm, I deleted |
It still gives the error when using the @marek-safar's explaination makes sense to me. Our plan is to just stay on 4.3.1 when running on Mono until Mono 5.2 ships with the updated table. Just not sure if this approach will work for others. I have to say - I'm concerned about the "deprecating the standalone packages" bit. Pulling in |
@mj1856 there are downsides of many packages - e.g. VS showing you 30 of them that you depend on. So it has pros and cons. Can someone confirm that there is reasonable path forward and decent user experience as well? I hope users don't have to delete packages, etc. when upgrading their projects. That would be pretty unfortunate. |
@ericstj is there any doc how NETStandard.Library.NETFramework package is suppose to be used or migrated to? It now has PreferInbox flag but as nobody told us about new APIs there, it'll crash at runtime on Mono due to API mismatch. |
I believe all the APIs in there are all part of netstandard 2.0. /cc @weshaggard @davidsh The plumbing for NETStandard.Library.NETFramework is still being worked on, coordinated by @terrajobst. The short of it is that it will be auto-referenced by NuGet when any ns2.0 package is installed to a packages.config-based project, and injected automatically by targets in any PackageReference-based target (similar to how netcoreapp and netstandard work today). |
@marek-safar @ericstj Hi guys I was wondering if you know if we have a resolution to the issue raised here? ... e.g. the missing method. |
I think two things need to happen for this to work:
@marek-safar can you comment on these? Should we open an issue in the mono repo? |
The resolution is described above link, manually delete the file or upgrade to recent Mono version (e.g. 5.2) which has updated hacks for broken NETStandard assemblies. |
@marek-safar I think Mono 5.2 hasn't released yet? |
It's available http://www.mono-project.com/download/alpha/ but still in preview |
Running into this on 5.2.0 Stable (5.2.0.215) windows. Trying to confirm something works correctly with mono.
Removing System.Net.Http.dll does not allow me to work around the problem either:
|
Is there any kind of fix for this yet? I've got a console app on .NET Framework 4.7, using the latest version of Visual Studio for Mac which comes with Mono 5.2.0.224. I get this error even after deleting the |
Still an issue with |
Also having this issue. We force our net461 application to use Mono's fallback System.Net.Http 4.0.0 from /usr/lib/mono/4.5-api by deleting the System.Net.Http that is published with the application and changing the existing record to:
in the <app_name>.exe.config after publishing for net461 (and netstandard2.0 on the side). But this is obviously not the preferred solution. Is anyone going to fix this in Mono? Mono version used: 5.4.0.167 |
@smuellener could you please file a bug report at bugzilla.xamarin.com with repro for us to investigate further? |
I'm currently trying to get an ASP.Net core project targeting .NET 4.7 running and I'm getting the same error with Mono 5.4.0.201 I could probably make a repro from a clean project if anyone is interested. |
@marek-safar I've put the smallest repro I could come up with in this repository. Do you still need someone to open a bug report? Basically this is the whole code: Program.cs public class Program
{
public static void Main(string[] args)
{
var result = new System.Net.Http.HttpClient()
.GetAsync("https://api.ipify.org/?format=json").Result;
}
} TestProj.csproj <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net47</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
</ItemGroup>
</Project> TestProj.sln
And this is basically my system information (you can see it in more detail in my repository):
|
We have the same problem. As proposed from @marek-safar I created a bug ticket here: https://bugzilla.xamarin.com/show_bug.cgi?id=60315 |
@stefan-schweiger @RF77 Thanks for the repro and bug report, will try to reproduce it locally |
@RF77 @marek-safar is there any reason why this issue is not viewable anymore on the xamarin bugtracker? |
Well, it's actionable on CoreFX side by stop relying on internal framework members. On Mono we have the only workaround which does patching of every version of this published NuGet for .NET Framework but as you can expect this is not a great solution |
I am confused as what exactly is wrong and what are the options. This issue is pretty confusing and going in many directions over time, which is not helping :( Latest System.Net.Http package is direct copy of Framework sources to cause as few problems with .NET Framework compat as possible. I would be hesitant to take any changes to it. So, the questions are:
|
The details are in the original log. I didn't check if this property access is the only occurrence but it probably is not. In more details NuGet version of System.Net.Http targetting .NET Framework includes code in |
@marek-safar Thanks for the details. In a perfect world, we would ship a new fixed version of this package. However, that is impossible now. The source code for the System.Net.Http NuGet package is built out of the release/2.0 branch which is now end-of-life. We no longer can even build a new System.Net.Http package out of the master branch. We no longer have the forked copy of the .NET Framework based System.Net.Http code in the master branch to build the .NET Framework targetted binary of System.Net.Http.dll. The guidance we give developers now is to stop using the System.Net.Http NuGet package. It is not needed anymore because the System.Net.Http.dll binary already ships in the Microsoft.NETCore.App package. And for .NET Framework targeted applications, the one in the GAC is used. We understand that some developers still use the package because it is either directly or indirectly used by the dependencies. For those cases, we have added tooling in Visual Studio to try to ignore the System.Net.Http.dll binary from that package and use the one from Microsoft.NETCore.App package or the GAC'd version on the machine. However, this solution is not perfect because for Mono based applications there is no sufficient tooling to do that redirection. The summary is that this is not something we can fix unfortunately except by the magic of time. Over time, developers will use updated packages of things that no longer bring in the legacy and broken System.Net.Http NuGet package. So, since this is not actionable anymore by CoreFx for this. We plan to close this issue. |
I think the proposal of not shipping any update to this package makes it easier for Mono to stay on top of things which is good. At the same time, it'd be helpful to mark this package as deprecated or something like that at nuget.org. |
@terrajobst @ericstj Is there any way we can "mark" the NuGet package for System.Net.Http as "deprecated" or "please stop using, instead you can simply use Microsoft.NETCore.App", etc.? Can we delist the package on NuGet.org so that new applications being developed won't find it? Or is this a "time solves all problems" kind of thing where eventually, all the upstream packages will change and stop including this package? |
This one doesn't contain anymore the System.Net.Http dependency. See https://github.com/dotnet/corefx/issues/19914#issuecomment-529113925
This one doesn't contain anymore the System.Net.Http dependency. See https://github.com/dotnet/corefx/issues/19914#issuecomment-529113925
- Update NBitcoin.Altcoins too (released with NBitcoin) - Remove Version attribute from PackageReferences of System.Net.Http - Remove package.config references of System.Net.Http - Remove binding redirect of System.Net.Http The new NBitcoin version is the first version that has System.Net.Http removed. See https://github.com/dotnet/corefx/issues/19914#issuecomment-529113925
- Upgrade NBitcoin&Nethereum&JsonRpcSharp to versions that don't depend on System.Net.Http - Update NBitcoin.Altcoins too (released with NBitcoin) - Remove Version attribute from PackageReferences of System.Net.Http - Remove package.config references of System.Net.Http - Remove binding redirect of System.Net.Http See https://github.com/dotnet/corefx/issues/19914#issuecomment-529113925
- Upgrade NBitcoin&Nethereum&JsonRpcSharp to versions that don't depend on System.Net.Http - Update NBitcoin.Altcoins too (released with NBitcoin) - Remove Version attribute from PackageReferences of System.Net.Http - Remove package.config references of System.Net.Http - Remove binding redirect of System.Net.Http See https://github.com/dotnet/corefx/issues/19914#issuecomment-529113925 (Note: if this approach didn't work, we would see the bug's characteristic MethodMissingException when running the integration tests that call the update-servers Makefile target.)
- Upgrade NBitcoin&Nethereum&JsonRpcSharp to versions that don't depend on System.Net.Http - Update NBitcoin.Altcoins too (released with NBitcoin) - Remove Version attribute from PackageReferences of System.Net.Http - Remove package.config references of System.Net.Http - Remove binding redirect of System.Net.Http See https://github.com/dotnet/corefx/issues/19914#issuecomment-529113925
The reason is that the new versions don't depend anymore on the deprecated System.Net.Http nuget package. See [1] forr more info. [1] dotnet/runtime#21777 (comment)
Marking old packages as deprecated is tracked in dotnet/core#7420. Since updating |
Hopefully this is the right place to report this. If not, please move and/or let me know where to report.
HttpClient
appears to be broken when running on Mono with the latest release. Consider the following:Compile with VS 2017, targeting .NET Framework 4.6.1. Run from the Windows command line:
Works, no problem. Run under Mono, and also works.
Now upgrade to 4.3.2
Run again. Works on .NET Framework, but under Mono, I get a
MissingMethodException
.In another app (which I can't post here), I get others as well:
Same results on Mono 4.8.0 or 5.0.0.
The text was updated successfully, but these errors were encountered: