claunia / plist-cil

C#/.NET parser for Apple and GnuStep Property List (aka plist), based on Java's dd-plist
Other
54 stars 17 forks source link

Binary compatibility with the Apple Plist format #21

Closed qmfrederik closed 7 years ago

qmfrederik commented 7 years ago

We use plist-cil to implement one of Apple's protocols, and we strive to get binary compatibility. That is, we generate the exact same value on disk as the macOS tools do.

We've noticed that plist-cil tries to re-use object IDs in a property list: if you add the same object twice, the BinaryPropertyListWriter will add it once to the property list file and re-use the same ID.

Unfortunately, we hit a scenario where we need to write same value twice to the file, with different IDs.

This PR implements that. Because it would be a pitty to loose the optimization, we've added a ReuseObjectIds property which can be used to control this behavior.

qmfrederik commented 7 years ago

May be related to #19

claunia commented 7 years ago

@qmfrederik can you add the tests from https://github.com/3breadt/dd-plist? I'm currently unable to use my VS2017 env and MonoDevelop has not yet been updated for the new csproj. I can write the tests manually but can't test'em 😢

qmfrederik commented 7 years ago

@claunia Sure, I'll take a stab at porting the tests.

re: .NET core, which OS are you on? On Mac, Visual Studio for Mac works pretty well, on Linux & Mac Visual Studio Code can also help :)

claunia commented 7 years ago

@qmfrederik usually I'm on a huge Linux with VMs for Mac and Windows 10. Right now I'm restricted to bed with a Mac laptop. I'll check VS:Mac then (let's hope nunit works there, it doesn't on VS2017).

qmfrederik commented 7 years ago

Yeah, at the moment NUnit doesn't fully support .NET Core yet, the only option which works is NUnitLite.

xUnit does work. It's pretty much a drop-in replacement. Let me see if I can get things to work with xUnit.

qmfrederik commented 7 years ago

@claunia I've had a look at the test in dd-plist and I'm moving the new tests over to plist-cil.

That said, I didn't see any tests related to binary file handling. Did you have a specific test in mind?

claunia commented 7 years ago

@qmfrederik https://github.com/3breadt/dd-plist/commit/a5fb37384d4ca7a3b5039a7605ca0e9ca926a6ec seems he did not create a unit test for this particular issue. Please feel free to create one.