unoplatform/uno · error · ArgumentException
Member '{0}' could not be resolved to a static member
Error message
Member '{0}' could not be resolved to a static member What it means
Thrown by StaticExtension when Member was supplied and MemberType was set, but neither a public static property nor a public static field with that Member name exists on MemberType. The lookup uses BindingFlags.Public | BindingFlags.Static, so non-public, instance-only, or misspelled members will not be found.
Source
Thrown at src/SourceGenerators/System.Xaml/System.Windows.Markup/StaticExtension.cs:77
}
if (MemberType != null) {
var pi = MemberType.GetProperty (Member, BindingFlags.Public | BindingFlags.Static);
if (pi != null)
{
return pi.GetValue (null, null);
}
var fi = MemberType.GetField (Member, BindingFlags.Public | BindingFlags.Static);
if (fi != null)
{
return fi.GetValue (null);
}
}
// there might be some cases that it could still
// resolve a static member without MemberType,
// but we don't know any of such so far.
throw new ArgumentException (String.Format (CultureInfo.InvariantCulture, "Member '{0}' could not be resolved to a static member", Member));
}
}
}
View on GitHub (pinned to 0418340488)
Solutions
- Verify the member exists as a public static field or property on MemberType using reflection or an IDE go-to-definition.
- Correct spelling and casing of Member to match the declared identifier exactly.
- If the member is instance-only, switch to a different binding strategy (cannot use x:Static).
- Ensure MemberType is the actual declaring type of the member, not a derived type where the member is shadowed or inaccessible.
- If only Member (no MemberType) is set, set MemberType explicitly — member-only resolution is not implemented.
Example fix
// before
var ext = new StaticExtension { Member = "PI", MemberType = typeof(Math) };
// Member="PI" works, but a typo like Member="pi" throws:
var ext2 = new StaticExtension { Member = "pi", MemberType = typeof(Math) };
// after
var ext = new StaticExtension { Member = "PI", MemberType = typeof(Math) }; Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate the member exists before invoking the extension
public static bool MemberResolves(Type memberType, string member)
{
if (memberType == null || member == null) return false;
var flags = BindingFlags.Public | BindingFlags.Static;
return memberType.GetProperty(member, flags) != null
|| memberType.GetField(member, flags) != null;
}
if (!MemberResolves(ext.MemberType, ext.Member))
throw new ArgumentException($"No static '{ext.Member}' on {ext.MemberType}"); Type guard
static bool IsResolvableStaticMember(Type t, string m)
=> t.GetProperty(m, BindingFlags.Public | BindingFlags.Static) != null
|| t.GetField(m, BindingFlags.Public | BindingFlags.Static) != null; Prevention
- Always set MemberType explicitly; member-only resolution is not implemented.
- Verify member visibility (must be public static) and exact casing.
- Use IDE go-to-definition on the member string to confirm it points to a real static symbol.
When it happens
Trigger: Setting MemberType and Member where Member names a private/protected static, an instance member, or simply a non-existent member on the type. Also triggered when MemberType is null and Member-only resolution is attempted (the code explicitly notes this case is unsupported).
Common situations: Typos in member names in x:Static directives; referencing instance members when a static was intended; MemberType pointing at a type loaded in a different assembly that lacks InternalsVisibleTo or is internal; relying on case-insensitive matching (the lookup is case-sensitive).
Related errors
- Member property must be set to StaticExtension before callin
- serviceProvider does not implement IXamlNameResolver
- typeName
- type
- Either TypeName or Type must be filled before calling Provid
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/1eabe65ecc1d3a33.
Report an issue: GitHub.