From f1ac28b0aa1f20c5eb50a5122f51ff2c5b99a304 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Sat, 6 May 2017 23:39:58 -0700 Subject: [PATCH] dotnet: log exceptions --- src/dotnet/FileSystemBase.cs | 1 + src/dotnet/Interop.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/dotnet/FileSystemBase.cs b/src/dotnet/FileSystemBase.cs index e7f98aa5..afe944ce 100644 --- a/src/dotnet/FileSystemBase.cs +++ b/src/dotnet/FileSystemBase.cs @@ -50,6 +50,7 @@ namespace Fsp /* operations */ public virtual Int32 ExceptionHandler(Exception ex) { + Api.FspDebugLog("%s\n", ex.ToString()); return STATUS_UNEXPECTED_IO_ERROR; } public virtual Int32 Init(Object Host) diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs index 5c395087..d90737e6 100644 --- a/src/dotnet/Interop.cs +++ b/src/dotnet/Interop.cs @@ -595,6 +595,10 @@ namespace Fsp.Interop internal delegate UInt32 FspWin32FromNtStatus( Int32 Status); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void FspDebugLog( + [MarshalAs(UnmanagedType.LPStr)] String Format, + [MarshalAs(UnmanagedType.LPStr)] String Message); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void FspDebugLogSetHandle( IntPtr Handle); @@ -658,6 +662,7 @@ namespace Fsp.Interop internal static Proto.FspVersion FspVersion; internal static Proto.FspNtStatusFromWin32 FspNtStatusFromWin32; internal static Proto.FspWin32FromNtStatus FspWin32FromNtStatus; + internal static Proto.FspDebugLog FspDebugLog; internal static Proto.FspDebugLogSetHandle FspDebugLogSetHandle; internal static unsafe Int32 FspFileSystemSetMountPointEx( @@ -950,6 +955,7 @@ namespace Fsp.Interop FspVersion = GetEntryPoint(Module); FspNtStatusFromWin32 = GetEntryPoint(Module); FspWin32FromNtStatus = GetEntryPoint(Module); + FspDebugLog = GetEntryPoint(Module); FspDebugLogSetHandle = GetEntryPoint(Module); } private static void CheckVersion()