HandyOrg/HandyControl · error · ExternalException
NotImplemented
Error message
NotImplemented
What it means
GPStream (a native-memory GIF stream wrapper in HandyControl) contains methods that are stubbed out via the protected NotImplemented() helper, which throws an ExternalException with E_FAIL. Calling Clone() or Revert() on this stream always fails because the functionality was never implemented in the managed GIF decoder. It signals a deliberately unsupported code path, not a data problem.
Solutions
- Remove or avoid code paths that call Clone() or Revert() on GPStream; re-create the stream from the source GIF bytes instead of cloning it.
- Implement Clone()/Revert() yourself by subclassing GPStream or wrapping it with your own stream class that supports the required operations.
- If the GIF is not animated or does not need seeking, use the stream unidirectionally (Read only).
Example fix
// before var cloned = (GPStream)gifStream.Clone(); // after var cloned = new GPStream(File.ReadAllBytes(gifPath)); // re-create instead of cloning
Defensive patterns
Strategy: try-catch
Validate before calling
if (stream is GPStream) { /* do not call Clone()/Revert() on GPStream */ } Try / catch
try { var clone = stream.Clone(); } catch (ExternalException ex) when (ex.Message == "NotImplemented") { // fall back to re-creating the stream from source bytes
stream = new GPStream(File.ReadAllBytes(gifPath)); } Prevention
- Never call Clone() or Revert() on GPStream; re-create streams from source bytes instead.
- Wrap GPStream usage behind an abstraction so stream-cloning code stays out of the GIF path.
When it happens
Trigger: Calling GPStream.Clone() or GPStream.Revert(); also reached if any internal GIF decoding path invokes these unimplemented members.
Common situations: Using the HandyControl GifImage pipeline in code that clones streams (e.g. caching, rewind/replay logic) or upgrading from a framework stream type that supported cloning to this wrapper.
Related errors
AI-assisted analysis of HandyOrg/HandyControl@2c0875ebd6 (2026-09-14).
Data as JSON: /api/errors/263a86320c1598c0.
Report an issue: GitHub.
Appendix: source
Thrown at src/Shared/HandyControl_Shared/Data/Gif/GPStream.cs:125
}
public virtual Stream GetDataStream()
{
return DataStream;
}
public virtual void LockRegion(long libOffset, long cb, int dwLockType)
{
}
protected static ExternalException EFail(string msg)
{
throw new ExternalException(msg, InteropMethods.E_FAIL);
}
protected static void NotImplemented()
{
throw new ExternalException("NotImplemented");
}
public virtual int Read(IntPtr buf, int length)
{
var buffer = new byte[length];
var count = Read(buffer, length);
Marshal.Copy(buffer, 0, buf, length);
return count;
}
public virtual int Read(byte[] buffer, int length)
{
ActualizeVirtualPosition();
return DataStream.Read(buffer, 0, length);
}
public virtual void Revert()
{View on GitHub (pinned to 2c0875ebd6)