ErythroGuild / irene

<Erythro>'s server admin bot.
Mozilla Public License 2.0
0 stars 0 forks source link

`OverwriteCreate` and `OverwriteDelete` audit logs cannot be fetched #21

Open Ernest314 opened 3 years ago

Ernest314 commented 3 years ago

Causes an InvalidCastException whenever the following line of code is executed (async-ness doesn't seem to matter) in the audit log module initialization:

List<DiscordAuditLogEntry> entry =
    new (erythro.GetAuditLogsAsync(1, null, type).Result);

This seems to work for all AuditLogActionTypes except OverwriteCreate and OverwriteDelete. (OverwriteUpdate seems to work fine??)

Currently the function call is wrapped inside a try/catch and returns null for the broken AuditLogActionTypes, but this means those audit log action types will never be able to be printed.

The dump of the thrown exception:

System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred. (Unable to cast object of type 'System.Int64' to type 'System.String'.)
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Irene.Modules.AuditLog.<init_audit_log_base>g__get_entry|15_0(AuditLogActionType type, <>c__DisplayClass15_0& ) in C:\Users\Ernest\Documents\Programming\Projects\irene\Irene\Modules\AuditLog.cs:line 459
   at Irene.Modules.AuditLog.<init_audit_log_base>d__15.MoveNext() in C:\Users\Ernest\Documents\Programming\Projects\irene\Irene\Modules\AuditLog.cs:line 478

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.String'.
Ernest314 commented 2 years ago

On further inspection, this seems to be a D#+ issue (that's unlikely to get fixed?)

Ernest314 commented 2 years ago

At the moment it's only broken for OverwriteDelete? but not OverwriteCreate

Ernest314 commented 2 years ago

Possibly linked to 2 new OverwriteDelete (not OverwriteCreate) entries that have been added since this issue was first opened? Very strange...

(D#+ dev says it's a breaking change on Discord's side that's causing this)