Closed mattiascibien closed 8 years ago
Yikes. Can you tell me what _tagFileService
represents?
_tagFileService is just a single instance I use with caliburn micro. It only keeps track of the file choosen using the file picker under Win8.1 and WP8.1 . I am investigating this bug using your source code from github and I discovered that the exception happens in:
public void CloseStream(Stream stream)
{
stream.Dispose();
}
when called from Mode setter.
Same issue here with windows phone 8.1
I don't have this error with my custom FileAbstraction maybe you should use (Stream).Flush() instead. This is my FileAbstraction class:
public class FileAbstraction : TagLib.File.IFileAbstraction
{
public FileAbstraction(string name, Stream stream)
{
this.Name = name;
this.ReadStream = stream;
this.WriteStream = stream;
}
public void CloseStream(Stream stream)
{
stream.Flush();
}
public string Name
{
get;
private set;
}
public Stream ReadStream
{
get;
private set;
}
public Stream WriteStream
{
get;
private set;
}
}
i have got this exception too, in the same area, already tried flush(), dispose() and even flushasync(). describing the situation: User pick a mp3 file from file picker, the tags appers in textboxes to the user could edit them, then when the user save changes i pick the same file, edit the tags with the inputs and try to save, in the save line it takes a lot of time and then is throw an exception maybe the stream is not being closed correctly, idk
Edit: i figure out what happen, I was setting a read stream to both read and write streams, so when saving it was crashing, works well now but just i can't find a good way to deal with album art, any one knows?
The following code in File.cs may give us some hints.
public AccessMode Mode {
get {return (file_stream == null) ?
AccessMode.Closed : (file_stream.CanWrite) ?
AccessMode.Write : AccessMode.Read;}
set {
if (Mode == value || (Mode == AccessMode.Write
&& value == AccessMode.Read))
return;
if (file_stream != null)
file_abstraction.CloseStream (file_stream);
file_stream = null;
if (value == AccessMode.Read)
file_stream = file_abstraction.ReadStream;
else if (value == AccessMode.Write)
file_stream = file_abstraction.WriteStream;
Mode = value;
}
}
First of all, note that last line is a recursive call, which is causing Process is terminated due to StackOverflowException
exception under certain scenarios.
Also notice the call to close the stream. So, if you implement Close() on a stream in your abstraction, then you'll probably end up with System.ObjectDisposedException: Cannot access a closed file.
Any updates on how to resolve this issue? Currently have the same problem in my WinRT app.
Managed to fix the issue, would like to push the fix to the repo but VS gives me HTTP Error 403 (Forbidden).
@RafaelYousuf you first need to fork the repo and then do the modifications in your fork.
After that you must create a pull request to be reviewed by the original author.
Have a nice day.
@mattiascibien thnx for the instructions. I pushed the changes to the repo.
@RafaelYousuf Nice work... :+1:
@mattiascibien thank you.
Hello, I am currently writing a Windows Store (and Phone 8.1) app using your Taglib-Sharp fork. I create the File object using:
Then i call file.Save() after modifying it and I get a stackoverflow exception.