Actually create the file when using CustomFileStream.CreateFile()#121
Merged
Conversation
75f6b6a to
3500149
Compare
ritchiecarroll
approved these changes
Dec 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Looking at commit 10c3444, it seems that the changes made to
CustomFileStreamin order to lazy-open files as needed has caused a bug inCustomFileStream.CreateFile(). The code in theCustomFileStreamconstructor expects the file to be created so that the file size can be retrieved from the file system. This causes the constructor to fail.openHistorian/Source/Libraries/GSF.SortedTreeStore/IO/FileStructure/Media/CustomFileStream.cs
Lines 98 to 99 in b7f45ce
This creates a bug that manifests in some of the test code, such as the samples in:
https://github.com/GridProtectionAlliance/openHistorian/blob/master/Source/Documentation/SampleCode/openHistorian.Core.dll/Sample0%20-%20Write%20Archive%20Points.cs
This PR resolves the bug by restoring the call to the
FileStreamconstructor that was removed in 10c3444. Unlike the code from before that commit, we must close the file stream immediately after creating the file because we won't be keeping it open for the lifetime of theCustomFileStreaminstance.