Posts

Showing posts from April, 2017

C#.NET AccountExpirationDate Parameter name: fileTime ---> System.ArgumentOutOfRangeException: Not a valid Win32 FileTime.

Image
So we've found a rather strange bug in .NET Framework from 3.5.1 to the latest version (4.6.2). When using the System.DirectoryServices.AccountManagement library you may get the following error when reading the AccountExpirationDate of a principal. Not a valid Win32 FileTime. Parameter name: fileTime ---> System.ArgumentOutOfRangeException: Not a valid Win32 FileTime. Parameter name: fileTime    at System.DateTime.FromFileTimeUtc(Int64 fileTime)    at System.DirectoryServices.AccountManagement.ADStoreCtx.DateTimeFromLdapConverter(dSPropertyCollection properties, String suggestedAdProperty, Principal p, String propertyName, Boolean useAcctExpLogic)    at System.DirectoryServices.AccountManagement.ADStoreCtx.AcctExpirFromLdapConverter(dSPropertyCollection properties, String suggestedAdProperty, Principal p, String propertyName)    at System.DirectoryServices.AccountManagement.ADStoreCtx.Load(Principal p, String principalPropertyName)    at System.Directo