dotnet/wpf · warning · NotSupportedException
SR.TimeStampNotAvailable
Error message
SR.TimeStampNotAvailable
What it means
ConvertFILETIMEToDateTime throws NotSupportedException with SR.TimeStampNotAvailable when both FILETIME parts are zero, meaning the compound file carries no valid timestamp. The library refuses to return a bogus date like Dec 31, 1600 that a zero FILETIME would convert to.
Solutions
- Wrap timestamp reads in try/catch for NotSupportedException and fall back to DateTime.MinValue or File system times.
- Check dwHighDateTime/dwLowDateTime availability via STATSTG before converting, if using the native layer directly.
- Obtain timestamps from the containing file (FileInfo) when per-storage times are unavailable.
- Regenerate the compound file with a writer that sets STATSTG times.
Example fix
// before
var created = storageInfo.CreationTime; // throws NotSupportedException
// after
DateTime created;
try { created = storageInfo.CreationTime; }
catch (NotSupportedException) { created = DateTime.MinValue; } Defensive patterns
Strategy: fallback
Prevention
- Treat per-storage timestamps as optional data.
- Fall back to container-file timestamps when storage times are absent.
- Regenerate files with writers that set STATSTG times when timestamps matter.
When it happens
Trigger: Accessing CreationTime/LastWriteTime/LastAccessTime (or enumeration results) on a storage or stream whose STATSTG FILETIME fields are all zero — typical for storages created by writers that never set timestamps.
Common situations: Compound files produced by non-.NET tools or older writers that leave time fields zeroed; streams created programmatically and never committed with timestamps.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- NotSupportedException
- SR.CanNotCreateContainerOnReadOnlyStream
- SR.CanNotCreateStorageRootOnNonReadableStream
- SR.CanNotDelete
- SR.CanNotOnNonExistStorage
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/8378cfec37849757.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/CompoundFile/StorageInfo.cs:1148
return returnValue;
}
/// <summary>
/// Convert a System.Runtime.InteropServices.FILETIME struct to the CLR
/// DateTime class. Strange that the straightforward conversion doesn't
/// already exist. Perhaps I'm just not finding it. DateTime has a
/// method to convert itself to FILETIME, but only supports creating a
/// DateTime from a 64-bit value representing FILETIME instead of the
/// FILETIME struct itself.
/// </summary>
private DateTime ConvertFILETIMEToDateTime( System.Runtime.InteropServices.ComTypes.FILETIME time )
{
// We should let the user know when the time is not valid, rather than
// return a bogus date of Dec 31. 1600.
if( 0 == time.dwHighDateTime &&
0 == time.dwLowDateTime )
throw new NotSupportedException(
SR.TimeStampNotAvailable);
// CLR
return DateTime.FromFileTime(
(((long)time.dwHighDateTime) << 32) +
(uint)time.dwLowDateTime ); // This second uint is very important!!
}
/// <summary>View on GitHub (pinned to 81131a70a4)