TypeInitializationException occurred at "new XBeeController()".
Closed this issue · 0 comments
yvechang commented
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();
}
}
`