Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
442 stars 60 forks source link

Crash When Saving Certain Files #217

Closed nlogozzo closed 11 months ago

nlogozzo commented 11 months ago

Hello again, upon saving certain files I am getting this crash:

An attempt was made to move the position before the beginning of the stream.
   at System.IO.MemoryStream.Seek(Int64 offset, SeekOrigin loc)
   at ATL.StreamUtils.CopySameStream(Stream s, Int64 offsetFrom, Int64 offsetTo, Int64 length, Int32 bufferSize, ProgressToken`1 progress)
   at ATL.StreamUtils.CopySameStream(Stream s, Int64 offsetFrom, Int64 offsetTo, Int64 length, ProgressToken`1 progress)
   at ATL.StreamUtils.LengthenStream(Stream s, Int64 oldIndex, UInt32 delta, Boolean fillZeroes, ProgressToken`1 progress)
   at ATL.AudioData.IO.FileSurgeon.RewriteZones(Stream fullScopeWriter, WriteDelegate write, ICollection`1 zones, TagData dataToWrite, Boolean tagExists, Boolean useBuffer)
   at ATL.AudioData.IO.FileSurgeon.RewriteZones(Stream w, WriteDelegate write, ICollection`1 zones, TagData dataToWrite, Boolean tagExists)
   at ATL.AudioData.IO.FLAC.Write(Stream s, TagData tag, ProgressToken`1 writeProgress)
   at ATL.AudioData.AudioDataManager.UpdateTagInFile(TagData theTag, TagType tagType, ProgressManager writeProgress)

It's only happening with Annihilate.flac from this link: https://drive.proton.me/urls/KKKTXFCW3W#1tCqnQ0mqZhd (too big to send here on Github).

The crash happens but upon reloading the file again, the change is there.

Zeugma440 commented 11 months ago

Roger that. However I can't guarantee anything more for today. ATL doesn't pay my bills 😅

nlogozzo commented 11 months ago

Roger that. However I can't guarantee anything more for today. ATL doesn't pay my bills 😅

Haha no worries, Tagger doesnt either...i'm heading to work now myself so I get it 🤣 beta release will just have to wait till lager no big deal

nlogozzo commented 11 months ago

beta release will just have to wait till lager no big deal

And like i said it doesn't happen to all files and it actually still saves the changes (just Tagger reports it as unable to save since it throwa the error) so probably could still release lol

Zeugma440 commented 11 months ago

Just tried to reproduce that without success (add a composer and an embedded picture + save the file => no issue).

Could you post code that can help me reproduce that issue?

Did you change Settings.FileBufferSize by any chance?

Thanks~

nlogozzo commented 11 months ago

Could you post code that can help me reproduce that issue?

Same from #215

Did you change Settings.FileBufferSize by any chance?

Ah yes, changed it to 1024

Zeugma440 commented 11 months ago

I'm sorry, I still can't reproduce that issue on my side 🤔

Plus looking at the stacktrace alone isn't enough for me to guess what went wrong.

Are you certain I just need to run that piece of code ?

ATL.Settings.FileBufferSize = 1024
var track = new Track(path_to_annihilate);
track.Album = "test"
track.Save(); 
nlogozzo commented 11 months ago

Here's what Tagger really does... When a user changes a text box of a property (for example changes a property)....The updates are sent from the MainWindow to the controller which in turns, updates each tag property of the MusicFile .

Then when the user clicks the Apply button, the changes are written to disk. the call of track.Save() is causing the crash...everything else before causes no errors.

nlogozzo commented 11 months ago

ummm it's magically working for me now....lmao

nlogozzo commented 11 months ago

ok can't reproduce anymore...maybe it was something on my system that day...will reopen if it happens again