-
Notifications
You must be signed in to change notification settings - Fork 344
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
INotifyWrite is not called when using asynchronous methods #391
Comments
Thank you for your comment, I will look into the issue next week. In the meantime: Matthias |
In this case, it was possible to use the |
In my case, the data I have describes a hierarchical layout with some caveats. I build the hierarchy while reading. For writing, I use the WriteStream process and pass the engine down the hierarchy. This aspect is working quite well. However, there are fields on some records that can be formatted in multiple ways. Another field in the same class defines how it should be formatted. How I was hoping to solve the problem is to have concrete types that are hidden and use a string field to hold the parsed value. I could then inherit from INotifyRead and INotifyWrite and use the AfterRead to interrogate the definition field and then perform the conversion and set the concrete variable. I would then use the BeforeWrite to perform the conversion in the opposite direction. In my investigation, it seems as though the RecordInfo variable always seems to reference the first typeof() sent into the constructor and never gets updated to reference the current record type being worked on. The result is the MustNotifyRead/MustNotifyWrite is checking the wrong object. So my AfterRead and BeforeWrite will never be called. Looking deeper into the code, it appears as though even if the above aspect was working correctly, the WriteRecord is missing MustNotifyWrite checks blocks for before/after the RecordToString call. I just started using this repo last week, so I could be missing a/some procedural steps. Thanks! Paul |
I think there are two bugs hidden
Thank you for your analysis. Unfortunately I cannot fix these bugs in April. |
|
Thank you for your patience. These bugs should be fixed. I will publish a release next week. |
I have several record types that I am using with the
MultiRecordEngine
which implement theINotifyWrite
interface. When I write a file using theWriteFile
method, theBeforeWrite
andAfterWrite
methods are called as expected. When I write a file using theBeginWriteFile
andWriteNext
methods, the before and after hooks are not called at all. Examining the source code shows that the internal propertyMustNotifyWrite
is not checked during the asynchronousWriteRecord
method, while it is checked in the synchronousWriteStream
method. This is clearly an oversight, as the asynchronousReadRecord
checks theMustNotifyRead
property and functions the same as the synchronousReadStream
method. Please fix this so the before/after write hooks are called when using the asynchronous style methods.The text was updated successfully, but these errors were encountered: