2
votes

I'm using oxyplot with fsxaml and gjallarhorn. It works when using it directly and binding to output from DataPoint(x,y). However when I try the following example from SimpleDemoFsharp:

type MainViewModel() =
    let myModel = PlotModel()
    do 
        myModel.Series.Add(FunctionSeries(cos, 0.0, 10.0, 0.1, "cos(x)"))
    member mainWindow.MyModel with get() = myModel

The build fails with FSC: error FS2024: Static linking may not use assembly that targets different profile. The error appears to be caused by this line: myModel.Series.Add(FunctionSeries(cos, 0.0, 10.0, 0.1, "cos(x)")), if I uncomment it the project compiles. I have tried targetting lower .NET versions, and creating fresh projects but without much success. Is there a workaround? From search it appears that this maybe caused some PCL profile issues.

The example on its own compiles and works (i.e. no other nuget packages installed just oxyplot and oxyplot.wpf).

EDIT: After further testing the issue appears to be coming from a combination of FsXaml and Oxyplot. For example, when trying to load the MainWindow.xaml via FsXaml.

The fsc.exe command from VS2015 is below:

C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\fsc.exe -o:obj\x64\Debug\Gjallarhorn160611.exe -g --debug:full --noframework --define:DEBUG --define:TRACE --doc:bin\Debug\Gjallarhorn160611.XML --optimize- --platform:x64 --resource:obj\x64\Debug\Gjallarhorn160611.g.resources -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\FsXaml.Wpf.2.1.0\lib\net45\FsXaml.Wpf.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\FsXaml.Wpf.2.1.0\lib\net45\FsXaml.Wpf.TypeProvider.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\Gjallarhorn.Bindable.0.0.3-beta1\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Gjallarhorn.Bindable.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\Gjallarhorn.Bindable.Wpf.0.0.3-beta1\lib\net45\Gjallarhorn.Bindable.Wpf.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\Gjallarhorn.0.0.3-beta1\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Gjallarhorn.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\mscorlib.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\OxyPlot.Core.1.0.0-unstable2100\lib\net45\OxyPlot.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\OxyPlot.Wpf.1.0.0-unstable2100\lib\net45\OxyPlot.Wpf.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\OxyPlot.Wpf.1.0.0-unstable2100\lib\net45\OxyPlot.Xps.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\PresentationCore.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\PresentationFramework.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Numerics.dll" -r:"C:\Users\username\Documents\Visual Studio 2015\Projects\Gjallarhorn160611_A\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Xaml.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Xml.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\UIAutomationTypes.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\WindowsBase.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Collections.Concurrent.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Collections.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ComponentModel.Annotations.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ComponentModel.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ComponentModel.EventBasedAsync.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Diagnostics.Contracts.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Diagnostics.Debug.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Diagnostics.Tools.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Diagnostics.Tracing.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Dynamic.Runtime.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Globalization.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.IO.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Linq.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Linq.Expressions.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Linq.Parallel.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Linq.Queryable.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Net.NetworkInformation.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Net.Primitives.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Net.Requests.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ObjectModel.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Reflection.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Reflection.Emit.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Reflection.Emit.ILGeneration.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Reflection.Emit.Lightweight.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Reflection.Extensions.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Reflection.Primitives.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Resources.ResourceManager.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.Extensions.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.InteropServices.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.InteropServices.WindowsRuntime.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.Numerics.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.Serialization.Json.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.Serialization.Primitives.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.Serialization.Xml.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Security.Principal.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ServiceModel.Duplex.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ServiceModel.Http.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ServiceModel.NetTcp.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ServiceModel.Primitives.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.ServiceModel.Security.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Text.Encoding.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Text.Encoding.Extensions.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Text.RegularExpressions.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Threading.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Threading.Tasks.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Threading.Tasks.Parallel.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Xml.ReaderWriter.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Xml.XDocument.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Xml.XmlSerializer.dll" --target:exe --warn:3 --warnaserror:76 --vserrors --LCID:1033 --utf8output --fullpaths --flaterrors --subsystemversion:6.00 --highentropyva+ --sqmsessionguid:9587e2f2-adad-4417-931b-00c055df82f8 "C:\Users\username\AppData\Local\Temp.NETFramework,Version=v4.5.AssemblyAttributes.fs" AssemblyInfo.fs Model.fs Context3.fs Program.fs

2

2 Answers

2
votes

Pretty sure the error is in:

Gjallarhorn.Bindable.dll

and

Gjallarhorn.dll

For some reason you are referencing the portable libs.

Edit the paths to point to the full .net version

2
votes

Indeed, PCL and Type Providers don't play nice together. This appears to be caused by VisualF# Issue 99. Workaround is to move the ViewModel code to a separate library.