Describe the bug, including details regarding any error messages, version, and platform.
The dataset writer currently uses raw pointers of the pieces of state it needs to track, even though some of this state is accessed in async callbacks that might run at arbitrary points in time (especially in the case an error forces an early return of the synchronously running logic).
We should strive to strengthen the dataset writer code. Besides making it potentially more robust, it would also make future maintenance and evolutions easier.
Issue #45235 is probably related, though it's unclear it will be fixed here.
Component(s)
C++