MethodMissingException in F # user code; as?
I've written some simplified F # projects. Name them Console
and Library
.
Console
is a very simple console application netcoreapp2.0
. Here's the project file Console.fsproj
:
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Library/Library.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
</ItemGroup>
</Project>
Source Program.fs
:
open System
open Library
[<EntryPoint>]
let main argv =
let result = Stats.ema 0.0 [3.7; 8.9]
0 // return an integer exit code
Now Library.fsproj
:
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Library.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="4.1.*" />
<PackageReference Include="FSharp.NET.Sdk" Version="1.0.*" PrivateAssets="All" />
</ItemGroup>
</Project>
and Library.fs
:
module Library.Stats
let ema (prevEma:float) (values:float list) =
0.0
I can rebuild both projects just fine (using nuget.org only) and the build also works well:
C:\Users\ben\proj\scratch
ฮป dotnet build
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.
Library -> C:\Users\ben\proj\scratch\src\Library\bin\Debug\netstandard2.0\Library.dll
Console -> C:\Users\ben\proj\scratch\src\Console\bin\Debug\netcoreapp2.0\Console.dll
However, at runtime, the program throws out MissingMethodException
:
C:\Users\ben\proj\scratch\src\Console
ฮป dotnet run
Unhandled Exception: System.MissingMethodException: Method not found: 'Double Library.Stats.ema(Double, Microsoft.FSharp.Collections.FSharpList`1<Double>)'.
at Program.main(String[] argv)
Here's mine dotnet --info
:
C:\Users\ben\proj\scratch\src\Console
ฮป dotnet --info
.NET Command Line Tools (2.0.0-preview1-005977)
Product Information:
Version: 2.0.0-preview1-005977
Commit SHA-1 hash: 414cab8a0b
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0-preview1-005977\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0-preview1-002111-00
Build : 1ff021936263d492539399688f46fd3827169983
What is causing this?
Update:
As you can see from the comments, I found that there were conflicting links System.Runtime
, not FSharp.Core
, and that links are being added somewhere in the SDK or snap-in.
Still didn't get the hang of this good answer, I opened the issue in the dotnet / netcorecli-fsc repository .
source to share
No one has answered this question yet
Check out similar questions: