Details
Description
When building NPanday.Artifact project with Mono on Linux the following error is presented.
[INFO] /home/jfallows/Workspaces/npanday-trunk/dotnet/assemblies/NPanday.Artifact/target/build-sources/NPanday/Artifact/ArtifactRepository.cs(60,35): error CS0121: The call is ambiguous between the following methods or properties: `string.Split(char[*], int)' and `string.Split(char[*], int)' [INFO] /usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to previous error) Compilation failed: 1 error(s), 51 warnings [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] NPANDAY-900-006: Unable to Compile: Language = C_SHARP, Vendor = null, ArtifactType = library, Source Directory = /home/jfallows/Workspaces/npanday-trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp Embedded error: NPANDAY-040-001: Could not execute: Command = /bin/sh -c cd /usr/lib/mono/2.0 && gmcs @/home/jfallows/Workspaces/npanday-trunk/dotnet/assemblies/NPanday.Artifact/target/1920634/responsefile.rsp, Result = 1
This is caused by method signatures with Enum types being reduced to type int in Mono, and in this specific case it causes a collision with an existing String.split method signature that really does have an int parameter.
An example of the code causing the error can be found in ArtifactRepository.cs, line 60:
String[] tokens = uri.Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
A simple fix that keeps the precise meaning of the original code but makes the method signature unambiguous:
String[] tokens = uri.Split("/".ToCharArray(), Int32.MaxValue, StringSplitOptions.RemoveEmptyEntries);