mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
add debug info to static protoid in generic class error (#6395)
* add debug info to static protoid in generic class error * lets see * goida --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -94,7 +94,14 @@ public partial class PrototypeManager
|
||||
private bool TryGetIds(FieldInfo field, [NotNullWhen(true)] out string[]? ids)
|
||||
{
|
||||
ids = null;
|
||||
var value = field.GetValue(null);
|
||||
if (field.DeclaringType?.IsGenericTypeDefinition == true)
|
||||
{
|
||||
// field's class has generic parameters, rethrow to say what the field is because
|
||||
// c# is a great language and doesn't tell you anything in its exception in GetValue
|
||||
throw new InvalidOperationException($"Field {field.FieldType} {field.Name} cannot be a static field inside a generic class");
|
||||
}
|
||||
|
||||
object? value = field.GetValue(null);
|
||||
if (value == null)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user