Lachee / discord-rpc-csharp

C# custom implementation for Discord Rich Presence. Not deprecated and still available!
MIT License
561 stars 93 forks source link

[BUG] wrong format in Logging #207

Closed BadWolf97 closed 1 year ago

BadWolf97 commented 1 year ago

Describe the bug Uncatched exception on some users starting an app with the Software

To Reproduce Not reprducebale in most cases, only some of my users have this problem. I havent found a clear hint why.

Expected behavior A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

Additional context running in an WPF-App (FPH SpedV)

Exception Type: System.FormatException Message: Die Eingabezeichenfolge hat das falsche Format. Source: mscorlib Stack Trace:

bei System.Text.StringBuilder.FormatError()
bei System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
bei System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
bei System.String.Format(IFormatProvider provider, String format, Object[] args)
bei System.IO.TextWriter.WriteLine(String format, Object[] arg)
bei System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object[] arg)
bei System.Console.WriteLine(String format, Object[] arg)
bei DiscordRPC.Logging.ConsoleLogger.Error(String message, Object[] args) in C:\projects\discord-rpc-csharp\DiscordRPC\Logging\ConsoleLogger.cs:Zeile 98.
bei DiscordRPC.RPC.RpcConnection.MainLoop() in C:\projects\discord-rpc-csharp\DiscordRPC\RPC\RpcConnection.cs:Zeile 427.
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

Logs None available, due to its a customer issue and only come to my attention via our Exception Handler

Lachee commented 1 year ago

seems like its an error with the logging itself. Ill have a look into this

Bl0n commented 1 year ago

I'm seeing pretty much the exact same error with pretty much identical circumstances, though in a completely different and unrelated context.

2022-09-28 09:12:03,733 (ERROR) exception
System.FormatException: Input string was not in a correct format.
   at System.Text.StringBuilder.FormatError()
   at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.Format(IFormatProvider provider, String format, Object[] args)
   at System.IO.TextWriter.WriteLine(String format, Object[] arg)
   at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object[] arg)
   at System.Console.WriteLine(String format, Object[] arg)
   at DiscordRPC.Logging.ConsoleLogger.Error(String message, Object[] args)
   at DiscordRPC.RPC.RpcConnection.MainLoop()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
ChristianKernDev commented 1 year ago

Hi @Lachee, this bug was also noticed by some users of my application, which causes it to crash as this exception is thrown.

Maybe the actual error behind this is related to a discord update, but i can't debug it as it works on my machine. Could you please create a new version with this fix so i can update the library in my app and see if the error is then reproducable?

Kind regards and have a nice day, Christian