You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I'm Serializing an object with SaveObjectAsync in a folder where there alrady has been an object serialized, there are leftover characters. The existing content is not cleared.
{"IsAutomaticExportEnabled":true,"DataProvisioning":"Sampling","SamplingInterval":2}**al":2}**
``
there are leftovers at the end becasue the previous opbject used more characters. Deserializing afterwards crashes then.
Tested with Version 10.7.1 and also the new 11.0.2
Tested with FolderStorage
The text was updated successfully, but these errors were encountered:
public class FileStorageTests
{
[Fact]
public async Task SaveObject_ShouldSaveObjectClean()
{
using var storage = new FolderFileStorage(new FolderFileStorageOptions() { Folder = "Output" });
var file = $"test-{Random.Shared.Next()}.json";
var longTextInstance = new TestClass
{
TestProperty = "VeryLongString"
};
var shortTextInstance = new TestClass
{
TestProperty = "Short"
};
await storage.SaveObjectAsync(file, longTextInstance);
await storage.SaveObjectAsync(file, shortTextInstance);
var storedTestClass = await storage.GetObjectAsync<TestClass>(file);
}
public class TestClass
{
public required string TestProperty { get; set; }
}
}
I have not tested it with other implementations. As a workaround im deleting the existing file before writing the same again.
When I'm Serializing an object with SaveObjectAsync in a folder where there alrady has been an object serialized, there are leftover characters. The existing content is not cleared.
Example:
First Serializing output:
Second serialization:
The text was updated successfully, but these errors were encountered: