Closed PaulNoto closed 6 years ago
Yep, this was a regression. I just pushed it in 1.5-beta, which is beta because of some other stuff I'm testing. Once I'm finished with that I'll push 1.5. Thanks.
Just noticed you pushed an update today. I tried nugget again (after installing the latest update to VS17 Community).
XBeeNode.SampleReceived handlers still not being called. Is this to be expected at this point?
package id="BinarySerializer" version="7.5.6" targetFramework="net461" package id="XBee" version="5.3.3" targetFramework="net461" package id="XBee.Core" version="1.5.0" targetFramework="net461"
Thanks, Paul
Hm, I thought I fixed that but let me check on it tomorrow. Maybe I left it out
From: PaulNoto notifications@github.com Sent: Saturday, August 19, 2017 11:35:03 PM To: jefffhaynes/XBee Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/XBee] After NuGet update, XBeeNode.SampleReceived handler doesn't get called (#33)
Just noticed you pushed an update today. I tried nugget again (after installing the latest update to VS17 Community).
XBeeNode.SampleReceived handlers still not being called. Is this to be expected at this point?
package id="BinarySerializer" version="7.5.6" targetFramework="net461" package id="XBee" version="5.3.3" targetFramework="net461" package id="XBee.Core" version="1.5.0" targetFramework="net461"
Thanks, Paul
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/33#issuecomment-323561324, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR_k7sntIjx5UnlrsWuaYejQN9fkiks5sZ6lngaJpZM4O1fv-.
Thanks Jeff. No rush. My code still runs fine with the old software.
Hm, this seems to work for me using 1.5. Can you tell me a little more about your node configuration? Are you using 16 or 64-bit addressing? The way it's supposed to work is the controller receives all events and dispatches them to any nodes the framework knows about. The nodes are then responsible for comparing the dispatched event address to their own and deciding if it's an event that originated with that node or not. The bug was in the address comparison so if something is still wrong maybe there's another issue there.
Just checked my email. Ill look into how I'm actually creating a node. I'll probably end up making a test project to simplify what I'm doing. I'll let you know how that goes.
OK, I am still not sure why your old code works and the latest doesn't. My best guess is that somehow the way I create an XBeeNode is the problem. When I look at the Node with the debugger the Sample Received Handler is set OLD and New. I created a Stripped down Test Project with the NEW code and the debugger shows the Node's SampleReceived handler is set, however, it never calls the handler.
WOW! NuGet really bulks up a .Net 4.6 / 4.7 project with extra Microsoft stuff. The test project is almost 300MB. I wanted to send it to you (I'm not sure how to do that since it's 300MB) so you can see how my Reactive system of initializing the XBee nodes works. Remember, all my nodes send a sample every 1 minute, even the sleeping ones. I will include just the code from my MainWindow.xaml.cs file, so you can see how my code is working.
Results from using the Debugger to inspect nodes created using your old library and the latest library from NuGet. I can't spot a problem. The handler is set Old and New.
5526146530998065 ULong 13A20040F4F731 Hex String
xBeeNode = await controller.GetNodeAsync( new NodeAddress( new LongAddress( ulong.Parse( xli.xBeeAddressString, System.Globalization.NumberStyles.HexNumber ) ) ) );
Address = {0013A20040F4F731, FFFE} Is16BitDisabled = true LongAddress = {0013A20040F4F731} High = 1286656 IsBroadcast = false IsCoordinator = false Low = 1089795889 Value = 5526146530998065 ShortAddress = {FFFE} IsBroadcast = false IsDisabled = true Value = 65534 Controller = {XBee.XBeeController} DataReceived = null HardwareVersion = XBee24C SampleReceived = {Method = {Void DayNightDetector_SampleReceived(System.Object, XBee.SampleReceivedEventArgs)}} SensorSampleReceived = null
xBeeNode = await controller.GetNodeAsync( new NodeAddress( new LongAddress( ulong.Parse( xli.xBeeAddressString, System.Globalization.NumberStyles.HexNumber ) ) ) );
Address = {0013A20040F4F731, FFFE} LongAddress = {0013A20040F4F731} High = 1286656 IsBroadcast = false IsCoordinator = false IsDisabled = false Low = 1089795889 Value = 5526146530998065 ShortAddress = {FFFE} IsBroadcast = false IsCoordinator = false IsDisabled = true Value = 65534 Controller = {XBee.XBeeController} DataReceived = null FirmwareVersion = 16479 HardwareVersion = XBee24C Protocol = ZigBee SampleReceived = {Method = {Void DayNightDetector_SampleReceived(System.Object, XBee.SampleReceivedEventArgs)}} SensorSampleReceived = null _maxPayloadLength = null
Code from my test projects MainWindow.xaml.cs file:
using System; using System.Collections.Generic; using System.IO.Ports; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using XBee;
namespace WpfApp1 {
///
private XBeeController controller = null;
private XBeeNode _xBeeNode = null;
public MainWindow() {
InitializeComponent();
Await_DiscoverController();
}
private async void Await_DiscoverController() {
await DiscoverController();
}
//---------------------------------------------------------------------------
private async Task DiscoverController() {
// NOTE: Sometimes the controller will take several tries before it is discovered
var ports = SerialPort.GetPortNames();
if ( ports.Length == 0 ) {
//historyLog.Add( new HistoryLog_Item( false, "Can't find XBee Controller on any USB Serial Port", HistoryLog_Item_Types.error ) );
return;
}
//historyLog.Add( new HistoryLog_Item( false, "Initializing XBee Controller", HistoryLog_Item_Types.info ) );
//historyLog.Add( new HistoryLog_Item( false, string.Format( "Checking serial ports: {0}", string.Join( ", ", ports ) ), HistoryLog_Item_Types.info ) );
int pass = 1;
do {
foreach ( var port in ports ) {
try {
controller = new XBeeController();
await controller.OpenAsync( port, 115200 );
//historyLog.Add( new HistoryLog_Item( false, string.Format( "Opened {0}", port ), HistoryLog_Item_Types.info ) );
controller.SampleReceived += Controller_SampleReceived;
pass = 0; // Finished initializing controller
}
catch ( Exception e ) {
controller?.Dispose();
controller = null;
//historyLog.Add( new HistoryLog_Item( false, string.Format( "Pass {0}: Failed to open {1} with {2}", pass, port, e.Message ), HistoryLog_Item_Types.error ) );
pass++;
}
if ( pass >= 30 ) {
//historyLog.Add( new HistoryLog_Item( false, string.Format( "Can't initialize XBee Controller on USB Serial Port {0}", port ), HistoryLog_Item_Types.error ) );
return;
}
}
} while ( pass != 0 );
//historyLog.Add( new HistoryLog_Item( false, "Finished Initializing XBee Controller", HistoryLog_Item_Types.info ) );
}
//---------------------------------------------------------------------------
public async void GetXBeeAsync( string hexAddressString ) {
try {
// I think somehow this is the problem.
_xBeeNode = await controller.GetNodeAsync( new NodeAddress( new LongAddress( ulong.Parse( hexAddressString, System.Globalization.NumberStyles.HexNumber ) ) ) );
}
catch {
return;
}
}
//---------------------------------------------------------------------------
ulong _test_XBeeNodeAddress_ULong = 5526146530998065;
string _test_XBeeNodeAddress_HexString = "13A20040F4F731";
bool _sampleHandlerSet = false;
/// <summary>
/// This is the incomming Method of the Controller XBee, every incomming communication hits this before the data is sent to the actual XBee Node object (if one exists).
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Controller_SampleReceived( object sender, SourcedSampleReceivedEventArgs e ) {
ulong nodeAddressULong = e.Address.LongAddress.Value;
if ( nodeAddressULong == _test_XBeeNodeAddress_ULong ) {
// Pass #1 Create Node
if ( _xBeeNode == null ) {
GetXBeeAsync( _test_XBeeNodeAddress_HexString );
return;
}
// Pass #2 Set Handler
if ( !_sampleHandlerSet ) {
_xBeeNode.SampleReceived += Node_SampleReceived;
_sampleHandlerSet = true;
return;
} else {
// Pass #3 For some reason the debugger won't show me the method, the Node's SampleReceived handler is set to, when I inspect the node on the third pass
// Pass #4 or more will let me inspect what method the Node's SampleReceived handler is set to. WEIRD!
XBeeNode node = _xBeeNode;
return; // Set Break Point Here to inspect fully initialized Node
}
}
}// END Controller_SampleReceived()
//---------------------------------------------------------------------------
private int _sampleReceived_Cntr = 0;
private void Node_SampleReceived( object sender, SampleReceivedEventArgs e ) {
_sampleReceived_Cntr++; // This Break Point never happens
}
}
}
Hi Jeff,
I've been looking into why using NuGet to update my project causes my project to get bulked up to 300MB on disk. It is being caused by using NuGet to add XBee.Core to the App.
I'm Using VS2017 Community and I create a basic WPF Blank Window Project.
My base WPF project is 336 KB on disk
My base WPF project after XBee.Core is 301 MB on disk
Do you know why NuGet is adding all the Updates, that are included below, as part of adding XBee.Core?
Thanks, Paul
package id="BinarySerializer" version="7.5.6" targetFramework="net461" /> package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="net461" /> package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" /> package id="NETStandard.Library" version="2.0.0" targetFramework="net461" /> package id="System.AppContext" version="4.3.0" targetFramework="net461" /> package id="System.Collections" version="4.3.0" targetFramework="net461" /> package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" /> package id="System.Console" version="4.3.0" targetFramework="net461" /> package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" /> package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" /> package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" /> package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" /> package id="System.Globalization" version="4.3.0" targetFramework="net461" /> package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" /> package id="System.IO" version="4.3.0" targetFramework="net461" /> package id="System.IO.Compression" version="4.3.0" targetFramework="net461" /> package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" /> package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" /> package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Linq" version="4.3.0" targetFramework="net461" /> package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" /> package id="System.Net.Http" version="4.3.2" targetFramework="net461" /> package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" /> package id="System.ObjectModel" version="4.3.0" targetFramework="net461" /> package id="System.Reflection" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net461" /> package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" /> package id="System.Runtime" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" /> package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" /> package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" /> package id="System.Threading" version="4.3.0" targetFramework="net461" /> package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" /> package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" /> package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" /> package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" /> package id="XBee.Core" version="1.5.0" targetFramework="net461" />
I assume it's just installing all base net core stuff but that does seem like a lot. Still planning on looking into this I'm just up to my eyeballs.
From: PaulNoto notifications@github.com Sent: Tuesday, August 22, 2017 12:23:35 PM To: jefffhaynes/XBee Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/XBee] After NuGet update, XBeeNode.SampleReceived handler doesn't get called (#33)
Hi Jeff,
I've been looking into why using NuGet to update my project causes my project to get bulked up to 300MB on disk. It is being caused by using NuGet to add XBee.Core to the App.
I'm Using VS2017 Community and I create a basic WPF Blank Window Project.
My base WPF project is 336 KB on disk
My base WPF project after XBee.Core is 301 MB on disk
Do you know why NuGet is adding all the Updates, that are included below, as part of adding XBee.Core?
Thanks, Paul
package id="BinarySerializer" version="7.5.6" targetFramework="net461" /> package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="net461" /> package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" /> package id="NETStandard.Library" version="2.0.0" targetFramework="net461" /> package id="System.AppContext" version="4.3.0" targetFramework="net461" /> package id="System.Collections" version="4.3.0" targetFramework="net461" /> package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" /> package id="System.Console" version="4.3.0" targetFramework="net461" /> package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" /> package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net461" /> package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" /> package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" /> package id="System.Globalization" version="4.3.0" targetFramework="net461" /> package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" /> package id="System.IO" version="4.3.0" targetFramework="net461" /> package id="System.IO.Compression" version="4.3.0" targetFramework="net461" /> package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" /> package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" /> package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Linq" version="4.3.0" targetFramework="net461" /> package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" /> package id="System.Net.Http" version="4.3.2" targetFramework="net461" /> package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" /> package id="System.ObjectModel" version="4.3.0" targetFramework="net461" /> package id="System.Reflection" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net461" /> package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" /> package id="System.Runtime" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" /> package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" /> package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" /> package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" /> package id="System.Threading" version="4.3.0" targetFramework="net461" /> package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" /> package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" /> package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" /> package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" /> package id="XBee.Core" version="1.5.0" targetFramework="net461" />
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/33#issuecomment-324079125, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR72KIuvqzCkOagLz3s9vR4h2KGwnks5sawCHgaJpZM4O1fv-.
I understand. Thanks, Paul
FYI, I just installed VS2017 update 15.3.3 and NuGet still adds all that stuff when addiding XBee.Core and bulks the disk footprint up to about 300MB. I feel like I am missing part of the .NET framework Library, because, what is the point of having a library if NuGet is going to add the individual library components to my project?
Anyway, No rush on this. I just keep using your old code and my project runs perfect. I just want to be able to keep up with changes to your library using NuGet. The real show stopper is that Node Sample Received Handlers stop working when I update to your latest release. The 300MB footprint is just a hassle for doing backups and remote deployment over the internet.
Ok, so starting with the sample issue. The only issue I see is that you are explicitly comparing 64-bit addresses. It would be better to compare the NodeAddress directly, as this will handle things like 16 vs 64 bit addressing. In your example, if you are receiving samples with 16-bit addresses, this check will never succeed. However, assuming your nodes are operating in 64-bit mode then this should work. I used your code exactly, simply swapping out the test address for one of my devices and everything seems to work. Once the node is setup, the Node_SampleRecieved breakpoint is hit.
It does sound like something weird is going on with your dev environment. Maybe try uninstalling and re-installing .net core? I have run into issues in the past where older versions of .net core were clobbering newer versions.
I'm focusing on the XBee.Core issue first. I did as you suggested and removed .net core and reinstalled it, which also gave me version 2.0. It did not help. I have VS2017 15.3.3 installed on 2 other computers. 1 is WIN 7 the other is Win 10. Both do the same thing. NuGet wants to add all those packages to the project. I'm at a loss. I've looked at everything I can think of, and don't see anything wrong.
All I'm doing is creating a Visual C#; Windows Classic Desktop; .Net Framework 4.6.1; WPF App (.Net Framework) Project. Then I go to Tools; NuGet Package Manager; Manage NuGet Packages for Solution. Then I Browse for xbee, and select XBee.Core. Then I try to install it and it comes up with a window listing all the other packages it is going to install.
I was hoping, when you have time, that you could try this procedure and let me know what happens. Thanks, Paul.
FYI: I was trying different experiments and discovered that if I use the following process of adding things with NuGet I can reduce the disk footprint from 300MB to 190MB and have far fewer packages added to the project.
So I create a WPF App. Then I use NuGet to add NETStandard.Library, which also adds Microsoft.NETCore.Platforms. Then I add XBee.Core. Then I add XBee.
Now my disk footprint is about 190MB and my packages are:
package id="BinarySerializer" version="7.5.7" targetFramework="net461" /> package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="net461" /> package id="NETStandard.Library" version="2.0.0" targetFramework="net461" /> package id="System.Collections" version="4.3.0" targetFramework="net461" /> package id="System.IO" version="4.3.0" targetFramework="net461" /> package id="System.Linq" version="4.3.0" targetFramework="net461" /> package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" /> package id="System.Reflection" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net461" /> package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" /> package id="System.Runtime" version="4.3.0" targetFramework="net461" /> package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" /> package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" /> package id="System.Threading" version="4.3.0" targetFramework="net461" /> package id="XBee" version="5.3.3" targetFramework="net461" /> package id="XBee.Core" version="1.5.0" targetFramework="net461" />
I still think something is wrong with the configuration, because this seems like a very complex process and I think it is still adding too many extra packages to the project. Hopefully, tonight I will have time to look at the Node_SampleReceived issue.
Yeah, this may be a side-effect that I don't totally understand of targeting both classic and .net standard in one package (it took me a long time just to get that to work). However, you do understand you don't have to deploy the packages directory, correct? The actually build is only around 1.5MB.
Started working the Node_SampleReceived issue. Something has changed, because my simplified test code that I sent to you, started throwing the following Exception when it is initializing the controller:
"There was an error reflecting type 'XBee.Frame'"
So I simplified it even more and this exception happens on my development machine and on my production machine.
Using VS2017 Community 15.3.3 , creating a C# , .Net Framework 4.7 , WPF App Note: I initially was having same problem with 4.61 and switched to for 4.7, but still had problem.
using System; using System.Windows; using XBee;
namespace WpfApp2 {
///
public MainWindow() {
InitializeComponent();
controller = new XBeeController();
Await_DiscoverController();
}
private async void Await_DiscoverController() {
try {
await controller.OpenAsync( "COM3", 115200 );
}
catch ( Exception e ) {
// Catches Exception: "There was an error reflecting type 'XBee.Frame'"
string s = e.Message;
}
}
}
}
Note: I started with my complicated process of using NuGet on the 4.61 App, so on the 4.7 App I used NuGet to just add XBee and let it add the zillion packages. The problem persists no mater what I do.
My NuGet packages are:
package id="BinarySerializer" version="7.5.7" targetFramework="net47" /> package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="net47" /> package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net47" /> package id="NETStandard.Library" version="2.0.0" targetFramework="net47" /> package id="System.AppContext" version="4.3.0" targetFramework="net47" /> package id="System.Collections" version="4.3.0" targetFramework="net47" /> package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net47" /> package id="System.Console" version="4.3.0" targetFramework="net47" /> package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net47" /> package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net47" /> package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net47" /> package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net47" /> package id="System.Globalization" version="4.3.0" targetFramework="net47" /> package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net47" /> package id="System.IO" version="4.3.0" targetFramework="net47" /> package id="System.IO.Compression" version="4.3.0" targetFramework="net47" /> package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net47" /> package id="System.IO.FileSystem" version="4.3.0" targetFramework="net47" /> package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Linq" version="4.3.0" targetFramework="net47" /> package id="System.Linq.Expressions" version="4.3.0" targetFramework="net47" /> package id="System.Net.Http" version="4.3.2" targetFramework="net47" /> package id="System.Net.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Net.Sockets" version="4.3.0" targetFramework="net47" /> package id="System.ObjectModel" version="4.3.0" targetFramework="net47" /> package id="System.Reflection" version="4.3.0" targetFramework="net47" /> package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net47" /> package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net47" /> package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net47" /> package id="System.Runtime" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.Handles" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net47" /> package id="System.Text.Encoding" version="4.3.0" targetFramework="net47" /> package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net47" /> package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net47" /> package id="System.Threading" version="4.3.0" targetFramework="net47" /> package id="System.Threading.Tasks" version="4.3.0" targetFramework="net47" /> package id="System.Threading.Timer" version="4.3.0" targetFramework="net47" /> package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net47" /> package id="System.Xml.XDocument" version="4.3.0" targetFramework="net47" /> package id="XBee" version="5.3.3" targetFramework="net47" /> package id="XBee.Core" version="1.5.0" targetFramework="net47" />
Is there an inner exception? Running the same code works for me so maybe there is a difference in how your device is configured that I'm not accounting for.
Generally speaking the useful information for XBee/BinarySerializer will be in the lowest nested exception.
I think it would be easier to let you RemoteDesktop into the ASROCK BeeBox that I'm using as my Dev System. So if you would like to do that, let me know.
Here is what I found on the InnerExceptions.
Looks like the InnerException chain ends in the BinarySerializer with:
InnerException {"XBee.Frames.ModemStatusData.StackStatusModemStatusData is not a subtype of XBee.Frames.ModemStatusData.ModemStatusExtData"} System.Exception {System.InvalidOperationException}
CHAIN of InnerExceptions: InnerException {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"There was an error reflecting member 'Payload'"} System.Exception {System.InvalidOperationException} Source "mscorlib" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"There was an error reflecting member 'Content'"} System.Exception {System.InvalidOperationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException} Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} Source "mscorlib" string InnerException {"There was an error reflecting member 'StatusData'"} System.Exception {System.InvalidOperationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException} Source "mscorlib" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"XBee.Frames.ModemStatusData.StackStatusModemStatusData is not a subtype of XBee.Frames.ModemStatusData.ModemStatusExtData"} System.Exception {System.InvalidOperationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException null System.Exception
STACK TRACE:
at BinarySerialization.Graph.TypeGraph.ContainerTypeNode.GenerateChild(Type type)
at BinarySerialization.Graph.GraphGenerator.<>c.2.GetOrAdd(TKey key, Func
2 valueFactory)
at BinarySerialization.Graph.GraphGenerator.GenerateGraph(Type valueType)
at BinarySerialization.BinarySerializer.Serialize(Stream stream, Object value, Object context)
at XBee.Core.XBeeControllerBase.1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at XBee.Core.XBeeControllerBase.<ExecuteAtQueryAsync>d__79
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at XBee.Core.XBeeControllerBase.1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at XBee.Core.XBeeControllerBase.<ExecuteAtQueryAsync>d__79
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at XBee.Core.XBeeControllerBase.
I can potentially do that but also it looks like you're getting modem status information, which the library doesn't really support right now. I'll take a look and see if I can fix it or at least stop it from breaking.
From: PaulNoto notifications@github.com Sent: Sunday, September 10, 2017 9:28:36 AM To: jefffhaynes/XBee Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/XBee] After NuGet update, XBeeNode.SampleReceived handler doesn't get called (#33)
I think it would be easier to let you RemoteDesktop into the ASROCK BeeBox that I'm using as my Dev System. So if you would like to do that, let me know.
Here is what I found on the InnerExceptions.
Looks like the InnerException chain ends in the BinarySerializer with:
InnerException {"XBee.Frames.ModemStatusData.StackStatusModemStatusData is not a subtype of XBee.Frames.ModemStatusData.ModemStatusExtData"} System.Exception {System.InvalidOperationException}
CHAIN of InnerExceptions: InnerException {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"There was an error reflecting member 'Payload'"} System.Exception {System.InvalidOperationException} Source "mscorlib" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"There was an error reflecting member 'Content'"} System.Exception {System.InvalidOperationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException} Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} Source "mscorlib" string InnerException {"There was an error reflecting member 'StatusData'"} System.Exception {System.InvalidOperationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException} Source "mscorlib" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException {"XBee.Frames.ModemStatusData.StackStatusModemStatusData is not a subtype of XBee.Frames.ModemStatusData.ModemStatusExtData"} System.Exception {System.InvalidOperationException} Source "BinarySerializer" string Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} InnerException null System.Exception
STACK TRACE:
at BinarySerialization.Graph.TypeGraph.ContainerTypeNode.GenerateChild(Type type)
at BinarySerialization.Graph.GraphGenerator.<>c.b1_0(Type type)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at BinarySerialization.Graph.GraphGenerator.GenerateGraph(Type valueType)
at BinarySerialization.BinarySerializer.Serialize(Stream stream, Object value, Object context)
at XBee.Core.XBeeControllerBase.d82.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at XBee.Core.XBeeControllerBase.d751.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at XBee.Core.XBeeControllerBase.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/33#issuecomment-328342715, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR0Z-msfGrmRLvxC1H7owL5IdUM34ks5sg-QEgaJpZM4O1fv-.
I fixed at least the immediate problem you're having in 1.5.1 although I'm not totally sure as to why you would even be receiving that status data. Give it a try but if this is a red herring or something I can try remoting and taking a closer look.
OK, I'll give it a try and let you know. Thanks, Paul
Same problem.
{"XBee.Frames.ModemStatusData.JoiningModemStatusData is not a subtype of XBee.Frames.ModemStatusData.ModemStatusExtData"}
Looks like NuGet has all your latest packages installed. Could it be that somehow one of them isn't being referenced correctly?
package id="BinarySerializer" version="7.5.7" targetFramework="net47" /> package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="net47" /> package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net47" /> package id="NETStandard.Library" version="2.0.0" targetFramework="net47" /> package id="System.AppContext" version="4.3.0" targetFramework="net47" /> package id="System.Collections" version="4.3.0" targetFramework="net47" /> package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net47" /> package id="System.Console" version="4.3.0" targetFramework="net47" /> package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net47" /> package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net47" /> package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net47" /> package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net47" /> package id="System.Globalization" version="4.3.0" targetFramework="net47" /> package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net47" /> package id="System.IO" version="4.3.0" targetFramework="net47" /> package id="System.IO.Compression" version="4.3.0" targetFramework="net47" /> package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net47" /> package id="System.IO.FileSystem" version="4.3.0" targetFramework="net47" /> package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Linq" version="4.3.0" targetFramework="net47" /> package id="System.Linq.Expressions" version="4.3.0" targetFramework="net47" /> package id="System.Net.Http" version="4.3.2" targetFramework="net47" /> package id="System.Net.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Net.Sockets" version="4.3.0" targetFramework="net47" /> package id="System.ObjectModel" version="4.3.0" targetFramework="net47" /> package id="System.Reflection" version="4.3.0" targetFramework="net47" /> package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net47" /> package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Reflection.TypeExtensions" version="4.4.0" targetFramework="net47" /> package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net47" /> package id="System.Runtime" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.Handles" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net47" /> package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net47" /> package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net47" /> package id="System.Text.Encoding" version="4.3.0" targetFramework="net47" /> package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net47" /> package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net47" /> package id="System.Threading" version="4.3.0" targetFramework="net47" /> package id="System.Threading.Tasks" version="4.3.0" targetFramework="net47" /> package id="System.Threading.Timer" version="4.3.0" targetFramework="net47" /> package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net47" /> package id="System.Xml.XDocument" version="4.3.0" targetFramework="net47" /> package id="XBee" version="5.3.3" targetFramework="net47" /> package id="XBee.Core" version="1.5.1" targetFramework="net47" />
ha, no. similar but different problem. Somehow you're getting a large number of diagnostic frames back. Sorry, try 1.5.2.
Will do.
OK, The controller is working.
I also updated my simple code to check Node_SampleReceived. That handler is still not getting called.
I need to check it some more and re-verify that my code is setting the handler and that I think it should be getting called. I'll let you know when I finish.
What really perplexes me is why everything works fine on your system, and I have two different systems that have the same problem. To me, it seems like somehow I have chosen a weird configuration for visual studio and the libraries that my project references.
Anyway, thank you for getting me past the first hurdle. I'll be in touch about the Node_SampleReceived issue in a little while.
Well I think it could easily be the difference between how our nodes are configured. Unfortunately it's trivial to receive the packet but actually complicated to figure out where it came from in all cases.
From: PaulNoto notifications@github.com Sent: Sunday, September 10, 2017 12:59:11 PM To: jefffhaynes/XBee Cc: Jeff Haynes; Comment Subject: Re: [jefffhaynes/XBee] After NuGet update, XBeeNode.SampleReceived handler doesn't get called (#33)
OK, The controller is working.
I also updated my simple code to check Node_SampleReceived. That handler is still not getting called.
I need to check it some more and re-verify that my code is setting the handler and that I think it should be getting called. I'll let you know when I finish.
What really perplexes me is why everything works fine on your system, and I have two different systems that have the same problem. To me, it seems like somehow I have chosen a weird configuration for visual studio and the libraries that my project references.
Anyway, thank you for getting me past the first hurdle. I'll be in touch about the Node_SampleReceived issue in a little while.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/jefffhaynes/XBee/issues/33#issuecomment-328356090, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJSKR8a8GrIaqSrtHFqSxRLYRow8h37Rks5shBVfgaJpZM4O1fv-.
Continued in #36
Hi Jeff,
I just used NuGet to update my project and my handlers for XBeeNode.SampleReceived are not getting called. Note: Controller.SampleReceived still works.
I was using VS2015 Community, so I installed VS2017 Community and restored my project from backup. Ran my original code in VS2017 and it still works. Then, from VS2017, I used NuGet to update my project again. Same problem. I was hoping you could look at the following and give me an idea of what is wrong.
My original code that works:
package id="BinarySerializer" version="6.0.3" targetFramework="net452" package id="XBee" version="4.2-beta" targetFramework="net452"
// .Net 4.5.2 controller = new XBeeController( port, 115200 ); await controller.OpenAsync();
controller.SampleReceived += Controller_SampleReceived;
private void Controller_SampleReceived( object sender, SourcedSampleReceivedEventArgs e ) { }
xBeeNode.SampleReceived += DayNightDetector_SampleReceived;
private void DayNightDetector_SampleReceived( object sender, SampleReceivedEventArgs e ) { }
Updated from NuGet
package id="BinarySerializer" version="7.5.6" targetFramework="net461" package id="XBee" version="5.3.3" targetFramework="net461" package id="XBee.Core" version="1.4.4" targetFramework="net461"
// .Net 4.6.1 controller = new XBeeController(); await controller.OpenAsync( port, 115200 );
controller.SampleReceived += Controller_SampleReceived;
**** This handler still gets called private void Controller_SampleReceived( object sender, SourcedSampleReceivedEventArgs e ) { }
xBeeNode.SampleReceived += DayNightDetector_SampleReceived;
** This handler never gets called now private void DayNightDetector_SampleReceived( object sender, SampleReceivedEventArgs e ) { }
I'm lost. Hope you can show me the path. Thanks, Paul