discord-rpc-csharp icon indicating copy to clipboard operation
discord-rpc-csharp copied to clipboard

[BUG] wrong format in Logging

Open BadWolf97 opened this issue 3 years ago • 1 comments

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):

  • OS: Windows
  • Framework: .NET Framework 4.8
  • Library Version: 1.143.0

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

BadWolf97 avatar Sep 24 '22 10:09 BadWolf97

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

Lachee avatar Sep 25 '22 03:09 Lachee

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()

Bl0n avatar Sep 28 '22 12:09 Bl0n

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

ChristianKernDev avatar Oct 06 '22 11:10 ChristianKernDev