Bug 43695 - Nuget resolves .netstandard <= 1.3 when Xamarin.IOS does not support it
Summary: Nuget resolves .netstandard <= 1.3 when Xamarin.IOS does not support it
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 4.6.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: 4.6.0 (C8)
Assignee: Alexander Köplinger [MSFT]
Depends on:
Reported: 2016-08-24 08:52 UTC by NicolasDorier
Modified: 2016-08-29 12:10 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description NicolasDorier 2016-08-24 08:52:25 UTC
Step to reproduce

* Create new IOS App.
* Add package NBitcoin.
* Add this line: new NBitcoin.Mnemonic(NBitcoin.Wordlist.English, NBitcoin.WordCount.Twelve)


* Runtime error System.StringNormalizationExtensions.Normalize not implemented.


* Nuget should not reference the .NETStandard 1.3 dll of NBitcoin but .NETStandard 1.1
Comment 1 Matt Ward 2016-08-24 09:50:42 UTC
As far as I am aware the NuGet logic is correct since Xamarin.iOS would be mapped to the highest supported .NETStandard assembly available in the NuGet package which for the Bitcoin NuGet package is 1.3. So it looks like the problem is that iOS does not fully implement .NETStandard 1.3.

Xamarin Studio 6.1 uses NuGet 3.4.3 which specifies that Xamarin.iOS supports up to .NETStandard 1.5 so NuGet will pick the highest .NETStandard assembly the NuGet package supplies up to 1.5. In this case NBitcoin has assemblies for .NETStandard 1.1 and 1.3 and NuGet will pick .NETStandard 1.3 since that is supported.


This is similar to how a normal .NET project works. If your project targets .NET 4.5 ,and the NuGet package has assemblies for .NET 2.0, 4.0, then NuGet will pick the highest version that is compatible with your project, which here would be the 4.0 assemblies. NuGet does not pick the lowest target framework version.
Comment 2 NicolasDorier 2016-08-24 10:06:38 UTC
The problem currently is that Nuget says than XamarinIOS support .NETStandard 1.5. While in reality, it is not.
I need to tell my users to unload their project, and change the reference path from 1.3 to 1.6. (https://github.com/MetacoSA/NBitcoin/issues/188) which is very inconvenient, and kill the purpose of NetStandard.

So from now how should I proceed? Is it a nuget problem for mapping to the wrong netstandard version ? or is it a problem of xamarin which somehow does not implement netstandard as specified ?

If you intend to implement netstandard 1.3, do you have any idea around when it will be released?
Comment 3 NicolasDorier 2016-08-24 10:07:18 UTC
I mean chaging reference path from 1.3 to 1.1.
Comment 4 Marek Safar 2016-08-24 10:08:06 UTC
Matt, for C8 we should bump netstandard support up to 1.6
Comment 5 Matt Ward 2016-08-24 10:16:39 UTC
NuGet 3.4.4 currently maps Xamarin.iOS to .NETStandard 1.5.

NuGet 3.5 RC1 maps Xamarin.iOS to .NETStandard 1.7.

So I can modify NuGet 3.4.3 that ships with Xamarin Studio if we need to. If you are using VS 2015 with the latest stable NuGet v3.4.4 then VS and XS would then have different behaviour. Which may or may not be a problem.

Ideally this mapping would not be hard coded inside NuGet.
Comment 6 Alexander Köplinger [MSFT] 2016-08-24 11:00:46 UTC
@Marek, @Matt modifying NuGet to map XI to a different higher NETStandard version will not change the fact that we currently throw NotImplementedException for these string extensions: https://github.com/mono/mono/blob/59260ced5ae1471fac9e50a3c08d3c90a1a3710d/mcs/class/Facades/System.Globalization.Extensions/StringNormalizationExtensions.cs

These look like easy to implement methods (they exist on string already) so we should just add them to C8.
Comment 7 Marek Safar 2016-08-24 11:17:31 UTC
@alexander I know. My concern is to avoid another issue when someone will need 1.6 dependency which we announced as supported but does not appear to work based on Matts comment with C8.
Comment 8 Alexander Köplinger [MSFT] 2016-08-24 12:13:56 UTC
@Marek I see, that's a different issue. Since VS ships with a NuGet that maps XI to netstandard1.5 I'd prefer not modifying the NuGet we ship in XS as that'll just lead to even more confusion. Waiting for NuGet 3.5 might be the better option.

@Nicolas I opened a pull request with a fix for this issue: https://github.com/mono/mono/pull/3444

Thanks for reporting it! I'll post a link to builds for Xamarin.iOS once they're available.
Comment 9 Alexander Köplinger [MSFT] 2016-08-25 11:06:05 UTC
The missing StringNormalizationExtensions.Normalize implementation was fixed in mono master/399de6b18cb29b95ea6f479288b5634e956d89b1 and mono-4.6.0-branch/83897d4af182206f72a30c597093a3a6ed87e04d.

You can find a build of Xamarin.iOS which includes these changes on https://jenkins.mono-project.com/view/Xamarin.MaciOS/job/xamarin-macios-builds-cycle8/

For the more general issue of the netstandard mapping in NuGet I filed https://bugzilla.xamarin.com/show_bug.cgi?id=43742.
Comment 10 Sunil Kumar 2016-08-26 19:29:18 UTC
Reproduce Status:

I have tried to reproduce this issue with Mono + XI using steps mentioned in bug description and getting the same Runtime error System.StringNormalizationExtensions.Normalize not implemented. in Application output and application gets crash as shown in screencast: http://www.screencast.com/t/wqZJSNeZ3Zp

Verify Status:

I have checked this issue with latest C8 Mono + XI and observed that now this issue is working fine. Now application is working fine and not getting Runtime error System.StringNormalizationExtensions.Normalize not implemented. in Application output.

Screencast: http://www.screencast.com/t/rmcn3rU4TC

Environment info:

Hence I am closing this issue.
Comment 11 Sunil Kumar 2016-08-29 12:10:36 UTC
I also checked this issue with latest Master Mono + XI and observed that now this issue is working fine. Now application is working fine and not getting Runtime error 'System.StringNormalizationExtensions.Normalize not implemented.' in Application output. 

Screencast: http://www.screencast.com/t/TCNYeUMX

Environment info: