Actual behavior
In CSWin32's IStream definition, Seek is defined as follows (in the c# version at least):
void Seek(long dlibMove, global::System.IO.SeekOrigin dwOrigin, out ulong plibNewPosition)
According to the official documentation however, plibNewPosition can be set to NULL if the caller is not interested in the new position.
At the moment, if you implement the IStream interface in managed code, and the caller chooses to set plibNewPosition to NULL, the managed implementation throws a System.NullReferenceException when you set the plibNewPosition, with no way to handle this case correctly as far as I can tell.
Expected behavior
IStream.Seek should probably be defined as follows:
unsafe void Seek(long dlibMove, global::System.IO.SeekOrigin dwOrigin, ulong* plibNewPosition)
Repro steps
- NativeMethods.txtcontent:
- NativeMethods.jsoncontent (if present):
{
  "$schema": "https://aka.ms/CsWin32.schema.json",
  "public": false,
  "allowMarshaling": true
}Context
- CsWin32 version: 0.3.18-beta
- Win32Metadata version (if explicitly set by project): n/a
- Target Framework: net7.0
- LangVersion: n/a