dotnet/wpf · error · ArgumentNullException
stylusPointPropertyInfo
Error message
stylusPointPropertyInfo
What it means
The internal static StylusPointPropertyInfo.AreCompatible method throws ArgumentNullException (with the legacy string literal 'stylusPointPropertyInfo') when either of the two info arguments is null. Both arguments are required to compare property compatibility.
Solutions
- Ensure both StylusPointPropertyInfo instances are created before calling comparison code
- Filter nulls out of property info collections before compat checks
- Wrap the call and supply default property info (StylusPointPropertyInfoDefaults) for missing entries
Example fix
// before bool ok = StylusPointPropertyInfo.AreCompatible(info1, info2); // info2 may be null // after bool ok = info1 != null && info2 != null && StylusPointPropertyInfo.AreCompatible(info1, info2);
Defensive patterns
Strategy: type-guard
Validate before calling
if (info1 == null || info2 == null) return false; // or substitute defaults
Type guard
static bool IsNonNull(StylusPointPropertyInfo i) => i != null;
Try / catch
try { bool ok = StylusPointPropertyInfo.AreCompatible(a, b); }
catch (ArgumentNullException) { /* handle missing property info */ } Prevention
- Fully populate property info collections before comparisons
- Use StylusPointPropertyInfoDefaults for absent properties
When it happens
Trigger: Invoking AreCompatible internally (e.g. from StylusPointDescription comparison paths) with a null first or second StylusPointPropertyInfo.
Common situations: Custom stylus property tables containing null entries; code that builds property info arrays lazily and passes uninitialized slots into description-compat checks.
Related errors
- SR.Stylus_PlugInIsNull
- annotation component
- ArgumentNullException
- ArgumentNullException(argName)
- ArgumentNullException("characterBufferReference.CharacterBuf…
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/448f831160c83294.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointPropertyInfo.cs:111
internal set { _resolution = value; }
}
/// <summary>
/// Unit
/// </summary>
public StylusPointPropertyUnit Unit
{
get { return _unit; }
}
/// <summary>
/// Internal helper method for comparing compat for two StylusPointPropertyInfos
/// </summary>
internal static bool AreCompatible(StylusPointPropertyInfo stylusPointPropertyInfo1, StylusPointPropertyInfo stylusPointPropertyInfo2)
{
if (stylusPointPropertyInfo1 == null || stylusPointPropertyInfo2 == null)
{
throw new ArgumentNullException("stylusPointPropertyInfo");
}
Debug.Assert(( stylusPointPropertyInfo1.Id != StylusPointPropertyIds.X &&
stylusPointPropertyInfo1.Id != StylusPointPropertyIds.Y &&
stylusPointPropertyInfo2.Id != StylusPointPropertyIds.X &&
stylusPointPropertyInfo2.Id != StylusPointPropertyIds.Y),
"Why are you checking X, Y for compatibility? They're always compatible");
//
// we only take ID and IsButton into account, we don't take metrics into account
//
return (stylusPointPropertyInfo1.Id == stylusPointPropertyInfo2.Id &&
stylusPointPropertyInfo1.IsButton == stylusPointPropertyInfo2.IsButton);
}
}
}
View on GitHub (pinned to 81131a70a4)