-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tag destructor throws an exception with an incorrect IP #432
Comments
Is that throwing inside the destructor? Once the core library API call |
Yep there are definitely some bugs here, thanks for raising it @VitorKawao. There was some work done in #420 that introduced this issue and I'm surprised this hasn't surfaced before. Below are some repros of the problem.
|
PR #433 shuffles the logic around to resolve the above test cases. |
Thank you for the quick reply. Do you intend to generate libplctag-v1.6.0-alpha.3 after this fix? Thank you, |
Yes
Yes I would appreciate if could test with the permutations of synchronous and asynchronous initialization, explicit and implicit disposal, and plcs/tags that exist and those that don't, Explicit Disposalvar cts = new CancellationTokenSource();
cts.CancelAfter(60*1000); // 1 minute
while(!cts.IsCancellationRequested)
{
var tag = new Tag()
{
...
};
tag.Initialize(); // also test with `await tag.InitializeAsync()`
tag.Dispose();
} Implicit Disposalwhile(!cts.IsCancellationRequested)
{
var tag = new Tag()
{
...
};
tag.Initialize(); // also test with `await tag.InitializeAsync()`
// tag.Dispose();
} |
Hello, I tested using the libplctag.dll generated by #433, and it seems to work fine for both my bug and the two tests mentioned above. Best regards, |
Thanks! Released as v1.6.0-alpha.3 |
Can we close this? |
@kyle-github - I closed it, is there any work remaining? |
Sorry, missed that it was already closed! |
Hello,
I am using libplctag at version 1.6.0-alpha.2 and libplctag.NativeImport at version 2.0.0.0-alpha.5
I am trying to connect to Compact Logix PLC (Allen Bradley).
It works fine when the IP is correct, but when I use an invalid IP or the network is down, it generates an exception in the Tag destructor. (ErrNullPtr)
When I call tag.Initialize(); with an incorrect IP, it throws an exception that I can handle. However, after some time, the destructor is called asynchronously, and it throws the same exception again, causing my app to crash.
Is there a better way to check for a connection than using tag.Initialize()? Or is it possible to handle this exception?
I am attaching my debug logs
log.txt
Thank you,
Vítor Guedes
The text was updated successfully, but these errors were encountered: