Skip to content

XmlDocReader locks the file. #1374

Open
@XavierDa

Description

@XavierDa

Hello,

i was trying to use dragonfruit to load from a temp file (i am getting my documentation from an embded ressource) and saw that i could not delete the tempfile.

Upon further examination i see that dragonfruit is using a File.OpenText

return TryLoad(File.OpenText(filePath), out xmlDocReader);
that means that the file is locked until GC pass to free the file.

code to reproduce :

            string tempFile = Path.GetTempFileName();
            File.WriteAllText(tempFile , "<?xml version="1.0"?><doc><assembly><name>Test</name></assembly></doc>");
            XmlDocReader.TryLoad(tempFile, out XmlDocReader documentation);
            File.Delete(tempFile);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions