Conversation
src/libplctag/Tag.cs
Outdated
| var result = (Status)_native.plc_tag_destroy(nativeTagHandle); | ||
| ThrowIfStatusNotOk(result); | ||
| { | ||
| RemoveCallback(); |
There was a problem hiding this comment.
@kyle-github - this is the method that is used to tear down the tag either explicitly or implicitly by the garbage collector.
Previously, this code was checking that neither removing the event callback, nor destroying the tag, returned an error code, and if so would throw an exception. I'm not sure if there are any valid reasons for return an error code (other than bugs in the wrapper or core library), and I believe there is no recourse if either fail.
The new code fixes the bug that was there (found in #432) and also ignores any other errors that might occur.
Your thoughts?
Signed-off-by: timyhac <timyhac@gmail.com>
|
I can't thank you enough for not throwing that exception in the destructor. It was the source of many issues in live running systems when thrown from the finalizer invocation by the garbage collector thread. As you probably know exceptions from the GC thread are awful and cannot be handled like normal exceptions. |
No description provided.