diff --git a/Facepunch.Steamworks.Test/NetworkingSocketsTest.TestSocketInterface.cs b/Facepunch.Steamworks.Test/NetworkingSocketsTest.TestSocketInterface.cs
index 9e5c6c9..cbbfac8 100644
--- a/Facepunch.Steamworks.Test/NetworkingSocketsTest.TestSocketInterface.cs
+++ b/Facepunch.Steamworks.Test/NetworkingSocketsTest.TestSocketInterface.cs
@@ -96,7 +96,7 @@ namespace Steamworks
await Task.Delay( 1000 );
- Close();
+ //Close();
}
public override unsafe void OnMessage( Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel )
diff --git a/Facepunch.Steamworks/Networking/NetDebugFunc.cs b/Facepunch.Steamworks/Networking/NetDebugFunc.cs
index 85e7aaa..ec4cabd 100644
--- a/Facepunch.Steamworks/Networking/NetDebugFunc.cs
+++ b/Facepunch.Steamworks/Networking/NetDebugFunc.cs
@@ -4,5 +4,6 @@ using System.Runtime.InteropServices;
namespace Steamworks.Data
{
- delegate void NetDebugFunc( NetDebugOutput nType, string pszMsg );
+ [UnmanagedFunctionPointer( Platform.CC )]
+ delegate void NetDebugFunc( [In] NetDebugOutput nType, [In] IntPtr pszMsg );
}
\ No newline at end of file
diff --git a/Facepunch.Steamworks/SteamNetworkingUtils.cs b/Facepunch.Steamworks/SteamNetworkingUtils.cs
index 7e02b3a..b53760b 100644
--- a/Facepunch.Steamworks/SteamNetworkingUtils.cs
+++ b/Facepunch.Steamworks/SteamNetworkingUtils.cs
@@ -178,7 +178,9 @@ namespace Steamworks
set
{
_debugLevel = value;
- Internal.SetDebugOutputFunction( value, OnDebugMessage );
+ _debugFunc = new NetDebugFunc( OnDebugMessage );
+
+ Internal.SetDebugOutputFunction( value, _debugFunc );
}
}
@@ -187,6 +189,11 @@ namespace Steamworks
///
private static NetDebugOutput _debugLevel;
+ ///
+ /// We need to keep the delegate around until it's not used anymore
+ ///
+ static NetDebugFunc _debugFunc;
+
struct DebugMessage
{
public NetDebugOutput Type;
@@ -198,9 +205,9 @@ namespace Steamworks
///
/// This can be called from other threads - so we're going to queue these up and process them in a safe place.
///
- private static void OnDebugMessage( NetDebugOutput nType, string pszMsg )
+ private static void OnDebugMessage( NetDebugOutput nType, IntPtr str )
{
- debugMessages.Enqueue( new DebugMessage { Type = nType, Msg = pszMsg } );
+ debugMessages.Enqueue( new DebugMessage { Type = nType, Msg = Helpers.MemoryToString( str ) } );
}
///