I'm trying to use sfs client c# api inside a c# .net web api and it seems that inside the namespace Sfs2X.Logging there is a UnityEngine dependency. Is there not supposed to be a separate .dll or is that an error?
https://prnt.sc/KplDaR7ffffP
Dotnet .dll is using UnityEngine
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: Dotnet .dll is using UnityEngine
Hello.
This is not expected.
What version of the SFS2X C# API are you using?
How do you trigger the error?
We tested with the very minimal example below, in which we forcefully call the internal logger, and everything works as expected without issues:
This is not expected.
What version of the SFS2X C# API are you using?
How do you trigger the error?
We tested with the very minimal example below, in which we forcefully call the internal logger, and everything works as expected without issues:
Code: Select all
using Sfs2X;
using Sfs2X.Core;
SmartFox sfs = new SmartFox(true);
sfs.ThreadSafeMode = false;
sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
sfs.Connect("127.0.0.1", 9933);
Console.ReadKey();
void OnConnection(BaseEvent evt)
{
if ((bool)evt.Params["success"])
{
// Console.WriteLine("Connection was established");
sfs.Logger.Info("Connection was established");
}
else
{
// Console.WriteLine("Connection failed");
sfs.Logger.Error("Connection failed");
}
}
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: Dotnet .dll is using UnityEngine
I'm using version 1.8.4. I chose to add the .dll from inside SFS2X_API_CSharp_v1.8.4\Release\DotNet directory.
It might be a forgotten reference perhaps inside the Logging namespace because i build a small assembly named Unityengine as shown below, i added it in my project as an assembly reference and now it doesn't crash.
It might be a forgotten reference perhaps inside the Logging namespace because i build a small assembly named Unityengine as shown below, i added it in my project as an assembly reference and now it doesn't crash.
Code: Select all
using System;
namespace UnityEngine
{
public static class Debug
{
public static void Log(object message) => System.Console.WriteLine(message);
public static void LogWarning(object message) => System.Console.WriteLine("[WARN] " + message);
public static void LogError(object message) => System.Console.Error.WriteLine("[ERROR] " + message);
}
}
Last edited by PanagiotisMilios on 30 Sep 2025, 11:09, edited 1 time in total.
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: Dotnet .dll is using UnityEngine
The error is triggered upon starting the api and never runs. Also Smartfox console logs my user as type Unity.
15:11:47,280 INFO [SFSWorker:Ext:4] api.SFSApi - User login: { Zone: Test }, ( User Name: Web-api-server, Id: 3, Priv: 0, Sess: 127.0.0.1:51105 ) , Type: Unity
15:11:47,280 INFO [SFSWorker:Ext:4] api.SFSApi - User login: { Zone: Test }, ( User Name: Web-api-server, Id: 3, Priv: 0, Sess: 127.0.0.1:51105 ) , Type: Unity
Re: Dotnet .dll is using UnityEngine
It looks like the issue is in the Release dll only. Our previous test was with the Debug dll.
Not sure how this happened. I guess we didn't rebuild the release dll after the fix.
We will now fix this and let you know as soon as the updated API is available.
Thank you for reporting.
Not sure how this happened. I guess we didn't rebuild the release dll after the fix.
We will now fix this and let you know as soon as the updated API is available.
Thank you for reporting.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
Re: Dotnet .dll is using UnityEngine
The new API version (1.8.5) that fixes the reported issue in now online:
https://www.smartfoxserver.com/download/sfs2x#p=client
https://www.smartfoxserver.com/download/sfs2x#p=client
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
PanagiotisMilios
- Posts: 34
- Joined: 22 Jan 2023, 21:48
Re: Dotnet .dll is using UnityEngine
Great, thanks a lot for the fast response!