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:
deltanedas
2026-01-31 10:59:23 +00:00
committed by GitHub
parent 2722448474
commit 0e54fa7329

View File

@@ -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;