jefffhaynes / XBee

A .NET library for XBee wireless controllers
MIT License
40 stars 17 forks source link

TypeInitializationException occurred at "new XBeeController()". #61

Closed yvechang closed 4 years ago

yvechang commented 4 years ago

Hello, I am just a beginner in XBee. My goal is reading the MAC address of XBee devise which is connected with PC. However, "System.TypeInitializationException" occurred just at the first step,

var controller = new XBeeController();

and the Inner exception is "FileNotFoundException: cna not load file... 件 'BinarySerializer, Version=8.3.0.0, Culture=neutral, PublicKeyToken=null'

My developing environment is Visual Stuidio 2019 with C#. XBee.Classic and XBee.Core had added in "References". My application is WPF. My code is as followings. ` public partial class MainWindow : Window { private static XBeeController _controller; public MainWindow() { InitializeComponent(); Run(); }

    private static async void Run()
    {
        _controller = new XBeeController();
        await _controller.OpenAsync("COM6", 9600);

        var s2 = new XBeeSeries2(_controller);
        var serial = await s2.GetSerialNumberAsync();
    }
}

`