Always succeed
Fails on mono 5.18
https://gist.github.com/mattleibow/2f16d6903e1d8a6aa2d0fe246b531d6c
MayhemTests.cs(10,23): error CS0433: The type 'ReadOnlySpan<T>' exists in both
'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and
'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
https://gist.github.com/mattleibow/e1a3fd590d4931788f7244381f45b54c
https://github.com/mattleibow/ModernMacMayhem
VS bug #917895
I ran this same test for iOS, and I got this warning (same on android):
/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:/Users/matthew/.nuget/packages/system.buffers/4.4.0/ref/netstandard2.0/System.Buffers.dll' and 'Platform:System.Buffers.dll'. NETSDK1033: Choosing 'Platform:System.Buffers.dll' because AssemblyVersion '4.0.99.0' is greater than '4.0.2.0'. [/Users/matthew/Projects/ModernMacMayhem/tfk/tfk.csproj]
/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Reference:/Users/matthew/.nuget/packages/system.memory/4.5.2/lib/netstandard2.0/System.Memory.dll' and 'Platform:System.Memory.dll'. NETSDK1033: Choosing 'Platform:System.Memory.dll' because AssemblyVersion '4.0.99.0' is greater than '4.0.1.0'. [/Users/matthew/Projects/ModernMacMayhem/tfk/tfk.csproj]
/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Platform:System.Buffers.dll' and 'CopyLocal:/Users/matthew/.nuget/packages/system.buffers/4.4.0/lib/netstandard2.0/System.Buffers.dll'. NETSDK1033: Choosing 'Platform:System.Buffers.dll' because AssemblyVersion '4.0.99.0' is greater than '4.0.2.0'. [/Users/matthew/Projects/ModernMacMayhem/tfk/tfk.csproj]
/Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/xbuild/Microsoft/Microsoft.NET.Build.Extensions/Microsoft.NET.Build.Extensions.ConflictResolution.targets(33,5): message NETSDK1041: Encountered conflict between 'Platform:System.Memory.dll' and 'CopyLocal:/Users/matthew/.nuget/packages/system.memory/4.5.2/lib/netstandard2.0/System.Memory.dll'. NETSDK1033: Choosing 'Platform:System.Memory.dll' because AssemblyVersion '4.0.99.0' is greater than '4.0.1.0'. [/Users/matthew/Projects/ModernMacMayhem/tfk/tfk.csproj]
I need a workaround for this one that bogus me for a full week, i need to release the app to appstore now.
I fallback using VSMac which does not have this issue (xamarin.ios 12.8 and 12.10).
Using Windows VS2019 (xamarin.ios 12.10) it fails with the same error.
Using Windows VS2019preview (xamarin.ios 12.14) it fails with the same error.
Using Windows VS2017 (xamarin.ios 12.6) it succeeds.
Using Mac VS2019 stable (xamarin.ios 12.8) it succeeds.
6>C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
error CS0433: The type 'Memory<T>' exists in both 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'
I just realized this gets worse. If I am building on 5.16 and use the NuGet, then I now get a dependency on that NuGet. In order to use this assembly, I cannot be on 5.18.
If I build on 5.18, then I don't use the NuGet. But now there is a whole type missing form the world.
I see Span<T> and ReadOnlySpan<T> technically exists in Android, but is marked internal.
On latest stable the build passes - https://gist.github.com/chamons/9bfc63518a7917e67ad864c6fb98ee4a
Mono - 5.18.1.28
XM - 5.10.0.157
And preview - https://gist.github.com/chamons/f3198be18446b539299dea580a482eb0
mono 6.0.0.296
XM - 5.14.0.91
I know this was filed months ago and overlooked (apologies!). Could you try to reproduce on a more recent set of builds?
That is the point. It does not work with old mono. mono 5.16. So, if a user is building with an older version of Xamarin, then he will get type not found.
I missed the fact that you have to install builds from 4 months ago to reproduce.
Works:
XM: 5.2.1.13
Mono: 5.16.1.0 or 5.18.0.235
Fails:
XM: 5.6.0.25
Mono: 5.18.0.235
@mattleibow please let the team add (or not) vs-sync since it double the amount to training work
@mattleibow please let the team add (or not)
vs-syncsince it double the amount to training work
@spouliot I am not sure what you mean. That tag is already added.
@mattleibow Don't add vs-sync tags , we only need it for a subset of our bugs and it doubles our paperwork otherwise.

ah, ok.
This problem is back, for iOS only.
1> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Memory.dll",
1> but its name "System.Memory, Version=4.0.99.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
1> didn't match the expected name "System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51". (TaskId:29)
It is caused by the system.reactive nuget
Workaround: add the "System.Memory" nuget version 4.5.0 to the ios project. All other versions of System.Memory trigger the issue.
In the projects that have this issue, I add:
<PackageReference Include="System.Memory" Version="4.5.3" IncludeAssets="None" />
Note the IncludeAssets="None"
Or as @softlion says, use version 4.5.0: https://github.com/xamarin/xamarin-macios/issues/5687#issuecomment-526191065
This is not related to XM itself, it's a compiler error.
What happens is that the type ReadOnlySpan<T> [1] was added in .netstandard 2.1, which mono gradually added support over the last year (and it should be in full compliance in d16-3 / mono 6.4 [2]). If not then it's a (mono) bug.
Basically mono added ReadOnlySpan<T> in 5.18, which means external code (e.g. nugets) providing their own versions will conflict (and the compiler will produce an error like above).
Mono 5.16 did not have the type, so it behaved more like netstandard 2.0, and the external version of the type was fine (i.e. no compiler error).
If you use an earlier .netstandard (the above logs shows 2.0) then some nugets, that wants/needs the feature, might be including the type which can cause conflict. Updating those nugets to newer versions that target netstandard 2.1 should fix the issue.
Hopefully this situation will resolve itself with .net 5 since the everything will be closely sync'ed. In the mean time updating your mono might require you to update some of your nugets too.
[1] https://docs.microsoft.com/en-us/dotnet/api/system.readonlyspan-1
[2] https://github.com/mono/mono/issues/11430
For Xamarin to correctly implement .NETStandard 2.1 it needs to supersede all libraries which are absorbed into .NETStandard 2.1, same as it did with System.Runtime et-al for .NETStandard 2.0.
This will be a problem for all of the libraries which were absorbed into .NETStandard2.1. See https://github.com/dotnet/standard/issues/1063
@marek-safar it looks like you have these libraries but your build isn't preferring them over the nuget packages. We could go back and retro-actively service all the nuget packages to add placeholders, but that's a bad fix since it requires everyone to update.
I think Xamarin should update their build tooling to perfer their own copy of these. The way this works for .NETCore is through the .NET SDK's conflict resolution which prefers the newer framework assembly.
I think Xamarin should update their build tooling to perfer their own copy of these
I agree and that's what we did for assemblies which Xamarin needs to prefer over NuGet versions. As you can see from the log above the assembly actually exists in Xamarin.iOS and I believe this used to work.
1> Considered "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\System.Memory.dll",
1> but its name "System.Memory, Version=4.0.99.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
1> didn't match the expected name "System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51". (TaskId:29)
We need to investigate why the 4.0.99.0 is not the prefered version in msbuild resolution logic anymore.
/cc @radical who did the original testing IIRC