Now and Nawoo

NFTの制作記録、技術メモ → C#, Solidity, Blockchain, Bitcoin, Ethereum, NFT

Nethereum.HdWalletでEntryPointNotFoundException

Nethereum.HdWalletを使っていると、なぜか下のシンプルなコードでもEntryPointNotFoundException例外が発生した。

  • 環境
    • VisualStudio2019でコンソールアプリ(C#)を新規作成
    • TargetFrameworkは .NET5.0
    • NuGetでNBitcoinとNethereum.HdWalletの最新版をインストール
using System;
using Nethereum.HdWallet;

namespace Test1
{
    class Program
    {
        static void Main(string[] args)
        {
            var words = "daughter permit (中略) obtain mother";
            var wallet = new Wallet(words, "password");
            Console.WriteLine(wallet.GetAccount(0).Address);
        }
    }
}
例外がスローされました: 'System.EntryPointNotFoundException' (NBitcoin.dll の中)
型 'System.EntryPointNotFoundException' のハンドルされていない例外が NBitcoin.dll で発生しました
Entry point was not found.

調べたところ、NBitcoinとNethereumのバージョンの組み合わせが問題らしい。 NBitcoinのメジャーバージョンを一つ下げると問題なく動いた。

  • NBitcoin 6.0.8 & Nethereum.HdWallet 4.0.5 → 例外発生
  • NBitcoin 5.0.83 & Nethereum.HdWallet 4.0.5 → OK