Reflection error when using F # sprintf "% A" on Windows Phone

I have a set of F # post types, such as:

type Course =
    { Id : int
      Title : string
      Instructor : string
      Duration : string
      StartDate : string
      IconUrl : string
      Url : string 
      LectureSections : LectureSection list }

and LectureSection =
    { Title : string
      Completed : bool
      Lectures : Lecture list }

and Lecture = 
    { Title : string
      VideoUrl : string }

and at some point I call

sprintf "%A" course

where the course is an instance of the course record

In a normal .NET project this works fine, but on Windows Phone 7.1 / Silverlight 4 F # project (I use Daniel Mohl templates), I get this error:

Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.

The problem seems to be lists. Does anyone know about this?

+3
source share
1 answer

The templates must have an embedded FSharp.Core.dll file that disables functions not available on Windows Phone. Are you sure you are working with this DLL and not with a Windows PC?

Xbox360 XNA. F # dll, Xbox360, , dll.

, FSharp.Core:

 <PropertyGroup Condition="'$(TargetFramework)'=='Xbox360\CompactFramework\3.7'">
   <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
   <TargetFrameworkProfile>Client</TargetFrameworkProfile>
   <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
   <XnaPlatform>Xbox 360</XnaPlatform>
   <XnaProfile>HiDef</XnaProfile>
   <XnaCrossPlatformGroupID>a8d70e6b-9a75-4aec-80f8-62cf373f7368</XnaCrossPlatformGroupID>
   <XnaOutputType>Game</XnaOutputType>
   <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
   <DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH;FX_NO_DEBUG_PROXIES;FX_NO_EXIT;FX_FSLIB_IOBSERVABLE;FX_NO_WEB_CLIENT;FX_NO_WEB_REQUESTS;FX_NO_CHAR_PARSE;FX_NO_DEFAULT_DEPENDENCY_TYPE;FX_SIMPLE_SECURITY_PERMISSIONS;FX_NO_TRUNCATE;FX_NO_CULTURE_INFO_ARGS;FX_NO_REFLECTION_MODULE_HANDLES;FX_NO_OPERATION_CANCELLED;FX_NO_TO_LOWER_INVARIANT;FX_NO_EXIT_CONTEXT_FLAGS;FX_NO_BASED_ARRAYS;FX_NO_DOUBLE_BIT_CONVERTER;FX_NO_BINARY_SERIALIZATION;FX_NO_ASCII_ENCODING;FX_NO_DEFAULT_ENCODING;FX_NO_FILE_OPTIONS;FX_NO_NONBLOCK_IO;FX_NO_COMMAND_LINE_ARGS;FX_NO_ENVIRONMENT;FX_NO_PROCESS_START;FX_NO_APP_DOMAINS;FX_NO_PROCESS_DIAGNOSTICS;FX_FSLIB_STRUCTURAL_EQUALITY;FX_FSLIB_LAZY;FX_FSLIB_TUPLE;FX_NO_REFLECTION_EMIT</DefineConstants>
   <Tailcalls>false</Tailcalls>
   <!-- It would be better to use MSBuild resolution here, but the TargetFrameworkIdentifier etc. aren't set up quite correctly as yet -->
   <OtherFlags>$(OtherFlags) --simpleresolution -r:"C:\Program Files\Microsoft XNA\XNA Game Studio\v4.0\References\Xbox360\mscorlib.dll"</OtherFlags>
 </PropertyGroup>

.targets, :

<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" Condition="'$(TargetFramework)'=='Xbox360\CompactFramework\3.7'"/>

DLL, , , , , FSharp.Core.dll . , , DefineConstants.

+1

All Articles