Skip to content

Reading a preset without an Info chunk returns MetaInfo "" instead of null, so each read/write round trip adds an empty Info chunk #14

Open

Description

@matt-edmondson

What's wrong

VstPresetFile finishes reading with new VstPreset(classId, component, controller, metaInfo ?? string.Empty, version) (EffectsHost.Plugin/VstPresetFile.cs:269).

That contradicts the documented contract of VstPreset.MetaInfo: null when the container has no such chunk, where an empty value is a different thing. It also contradicts the OptionalChunksRoundTrip test's summary ("reports their absence"). That test only asserts ControllerState is null, so the regression is not caught.

Repro

At 936acc2:

  1. Write a preset with MetaInfo: null. The file is 77 bytes.
  2. Read it back: MetaInfo == "".
  3. Write it again. The file is now 97 bytes, because a zero-length Info chunk has been added.

A preset loaded and re-saved by the plugin therefore no longer matches the original bytes. A host or tool that treats "has an Info chunk" as meaningful sees a difference that the user never made.

Suggested fix

  • Pass metaInfo through without ?? string.Empty.
  • Add Assert.IsNull(restored.MetaInfo) to OptionalChunksRoundTrip.

Acceptance criteria

  • A preset written without meta info reads back with MetaInfo == null.
  • Re-writing it produces byte-identical output.

Activity

  1. matt-edmondson commented on Sep 29, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    Notes: This is a trivial fix: drop ?? string.Empty and add Assert.IsNull(restored.MetaInfo). Also add a byte-equality round-trip assertion, so future chunk-handling changes can't regress it silently.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions