Build/Test Issues

F# Xamarin.iOS library project fails to build (Cecil exception)

Started by pragmatrix on 5,452 views

Hi, I'm getting a "Build failure" with NCrunch and VS2015 Update 2 when I create an F# library project and explicitly refer FSharp.Core and mscorlib from the Xamarin.iOS framework (latest version at the time of this writing). Regular build works fine and I don't see another option to build a F# library and use it from a C# iOS project.

I was able to reduce the issue down to a simple type definition and created a small project here: https://github.com/pragmatrix/NCrunchFSharpiOSLib
And a zip file is here: https://github.com/pragmatrix/NCrunchFSharpiOSLib/releases

May be it's just a Cecil hickup, or am I doing something wrong?

Stacktrace:


System.NullReferenceException: Object reference not set to an instance of an object.
   at _Mono.Cecil.TypeSystem.LookupSystemType(String name, ElementType element_type)
   at _Mono.Cecil.TypeSystem.get_String()
   at _Mono.Cecil.SignatureReader.GetPrimitiveType(ElementType etype)
   at _Mono.Cecil.SignatureReader.ReadTypeSignature(ElementType etype)
   at _Mono.Cecil.SignatureReader.ReadGenericInstanceSignature(IGenericParameterProvider provider, IGenericInstance instance)
   at _Mono.Cecil.SignatureReader.ReadTypeSignature(ElementType etype)
   at _Mono.Cecil.MetadataReader.GetTypeSpecification(UInt32 rid)
   at _Mono.Cecil.MetadataReader.LookupToken(MetadataToken token)
   at _Mono.Cecil.MetadataReader.ReadType(UInt32 rid)
   at _Mono.Cecil.MetadataReader.InitializeTypeDefinitions()
   at _Mono.Cecil.MetadataReader.ReadTypes()
   at _Mono.Cecil.ModuleDefinition.<>c.<get_Types>b__72_0(ModuleDefinition _, MetadataReader reader)
   at _Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at _Mono.Cecil.ModuleDefinition.get_Types()
   at _Mono.Cecil.ModuleDefinition.GetType(String namespace, String name)
   at _Mono.Cecil.MetadataResolver.GetType(ModuleDefinition module, TypeReference type)
   at _Mono.Cecil.MetadataResolver.Resolve(IAssemblyResolver resolver, TypeReference type)
   at _Mono.Cecil.TypeReference.Resolve()
   at _Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
   at _Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
   at _Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
   at _Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
   at _Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
   at _Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
   at _Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
   at _Mono.Cecil.CustomAttribute.<Resolve>b__32_0(CustomAttribute attribute, MetadataReader reader)
   at _Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at _Mono.Cecil.CustomAttribute.Resolve()
   at _Mono.Cecil.CustomAttribute.get_Properties()
   at nCrunch.Compiler.AssemblyHashGenerator.(BinaryWriter , IEnumerable`1 )
   at nCrunch.Compiler.AssemblyHashGenerator.(BinaryWriter , TypeDefinition )
   at nCrunch.Compiler.AssemblyHashGenerator.ComputeHashForAssembly(AssemblyDefinition assembly)
   at nCrunch.Compiler.StaticManipulation.BuiltAssembly.GenerateSurfaceHash()
   at nCrunch.Compiler.RemoteBuildRunner..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters , FilePath , BuildOutput , DirectoryPath[] , FilePath[] )
   at nCrunch.Compiler.RemoteBuildRunner..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters )

Edited

Hi, thanks for sharing this issue.

I'm sorry, but at the moment, Xamarin and .NET core are not yet supported by NCrunch.

There are plans to implement support for .NET Core when this platform is eventually stabilised, and from there it will be possible to assess the feasibility of supporting Xamarin platforms.
Thank you Remco, it would be great if a future NCrunch version would show a warning if it's encountering an unsupported project type.
Hi, I've managed to get NCrunch to run tests by using a F# portable library profile 7, which is used my iOS application and referred by another regular .NET 4.5 library that contains the XUnit tests. Of course, that implies that the F# library does nothing iOS specific, so YMMV, .... I'm now NCrunching again :)

Post a reply

Log in to reply.