NtfsLib icon indicating copy to clipboard operation
NtfsLib copied to clipboard

"Sequence contains no matching element" exception

Open VladimirK69 opened this issue 3 years ago • 1 comments

System.InvalidOperationException HResult=0x80131509 Message=Sequence contains no matching element Source=System.Core StackTrace: at System.Linq.Enumerable.Single[TSource](IEnumerable1 source, Func2 predicate) at NTFSLib.IO.NtfsDirectory.PrepRecord() in ... NtfsLib\NtfsLib\NTFSLib\IO\NtfsDirectory.cs:line 48

Happening with files in "c:\Program Files\Microsoft SQL Server\MSSQL12.MSSQL2014\MSSQL\DATA" and "c:\Program Files\Microsoft SQL Server\MSSQL14.MSSQL2017\MSSQL\DATA" (SQL Server databases). This system drive was made by copying by Samsung/DataMigration, but server, file managers and C# library made by porting NTFSLib made by Yibo Cai are working.

In MFTRecord.Attributes

            // Get root
            _indexRoot = MFTRecord.Attributes.OfType<AttributeIndexRoot>().Single(s => s.AttributeName == DirlistAttribName);

I see [0] = {NTFSLib.Objects.Attributes.AttributeStandardInformation} [1] = {NTFSLib.Objects.Attributes.AttributeList} [2] = {NTFSLib.Objects.Attributes.AttributeFileName} [3] = {NTFSLib.Objects.Attributes.AttributeFileName} [4] = {NTFSLib.Objects.Attributes.AttributeObjectId} [5] = {NTFSLib.Objects.Attributes.AttributeLoggedUtilityStream}

VladimirK69 avatar Jun 15 '21 11:06 VladimirK69

Could seem that the AttributeList is not being expanded.

Unfortunately I'm not maintaining this library any more, as the codebase has been stale for some time and I've moved to other projects. You're more than welcome to try to insert code that expands the attribute list, alternatively you could look at projects like DiscUtils which has an NTFS library as well.

LordMike avatar Jun 15 '21 16:06 LordMike