question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled Exception-Method not found: ..LiteRepository.Insert... at ...FSharp.Extensions.LiteRepository.insertItem...

See original GitHub issue

Continuing with my first steps, I find that I still need to include some module. I get the following error addressed from the following line: LiteRepository.insertItem eorder

Unhandled Exception: System.MissingMethodException: Method not found: 'Void LiteDB.LiteRepository.Insert(System.__Canon, System.String)'.
   at LiteDB.FSharp.Extensions.LiteRepository.insertItem[a](a item, LiteRepository lr)
   at Program.main(String[] argv) in /app/appbook/Program.fs:line 248
    let eorder = { Id = 1; Items = [item1;item2];  OrderNumRange = "" }

    let queryedEOrder =
        db 
        |> LiteRepository.insertItem eorder
        |> LiteRepository.query<EOrder> 
        |> LiteQueryable.first

    match queryedEOrder.Items with 
    | [item1;item2] -> 
        match item1,item2 with 
        | :? IBarcode,:? IColor -> 
            pass()
        | _ -> fail()   
    | _ -> fail()
  
    printfn "Hello World from F#!"
    0 // return an integer exit code

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
srlopezcommented, May 4, 2019

Confirmed & Thanks! Removing <PackageReference Include="LiteDB" Version="4.1.4" /> from app.fsproj and dotnet restore && dotnet run print passed! on the screen:

dotnet restore && dotnet run
  Restore completed in 3.95 sec for /app/appbook.fsproj.
passed
Hello World from F#!

Thanks

0reactions
Zaid-Ajajcommented, May 4, 2019

Found it, you are using incompatible versions of LiteDB and LiteDB.FSharp:

<PackageReference Include="LiteDB" Version="4.1.4" />
<PackageReference Include="LiteDB.FSharp" Version="2.7.0" />

The fix is to remove <PackageReference Include="LiteDB" Version="4.1.4" /> from your package references and run dotnet restore && dotnet run because the right version will be pulled in a dependency of LiteDB.FSharp, so your project file will look something like:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="LiteDB.FSharp" Version="2.7.0" />
  </ItemGroup>

</Project>

Can you please confirm the fix when you remove the LiteDB package reference and run dotnet restore && dotnet run, I will close the issue for now, please re-open if the problem persists.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why am I getting a MissingMethodException when calling ...
I've found that sometimes i have to "trick" PS by passing an expression to a method rather than a PS variable.
Read more >
f# - Missing method exception while InvokeMember
I'm creating a COM component in F#. The component is expected to be used from scripting. The component code:
Read more >
Type Extensions - F# | Microsoft Learn
Learn how F# type extensions allow you to add new members to a previously defined object type.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found