You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When use Vanara.PInvoke.Shell32.SHFileOperation(SHFILEOPSTRUCT& lpFileOp) (target .NET 6.0)
got a System.TypeLoadException with
Message = "Cannot marshal field 'pFrom' of type 'SHFILEOPSTRUCT': Custom marshalers cannot be used on fields of structures."
What's wrong ?
Regards
JC
The text was updated successfully, but these errors were encountered:
You were correct, the definition of SHFILEOPSTRUCT was defined to use custom marshalers that aren't supported on structures. I have corrected it and supplied a test case to show its proper use.
usingvarfrom=SafeCoTaskMemHandle.CreateFromStringList([TestCaseSources.WordDoc,TestCaseSources.SmallFile]);usingvarto=SafeCoTaskMemHandle.CreateFromStringList([TestCaseSources.TempChildDir]);SHFILEOPSTRUCTshop=new(){wFunc=ShellFileOperation.FO_COPY,pFrom=from,pTo=to,fFlags=FILEOP_FLAGS.FOF_NOCONFIRMATION};Win32Error.ThrowLastErrorIf(SHFileOperation(refshop), i =>i!=0);
You should be able to pull v4.0.3 from AppVeyor (see README) shortly and I'll release to NuGet in the next 2 weeks.
When use Vanara.PInvoke.Shell32.SHFileOperation(SHFILEOPSTRUCT& lpFileOp) (target .NET 6.0)
got a System.TypeLoadException with
Message = "Cannot marshal field 'pFrom' of type 'SHFILEOPSTRUCT': Custom marshalers cannot be used on fields of structures."
What's wrong ?
Regards
JC
The text was updated successfully, but these errors were encountered: