Conversation
Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the System.Xaml API reference documentation for XamlSchemaContext.GetXamlType(Type) to reflect the currently observed exception thrown when a null Type is provided.
Changes:
- Updated the documented null-argument exception for
GetXamlType(Type)fromArgumentNullExceptiontoNullReferenceException.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wadepickett
left a comment
There was a problem hiding this comment.
@gewarren: I tried looking up the exception we are trying to document here in the source but didn't find what was expected. The current .NET source code throws ArgumentNullException, not NullReferenceException, when GetXamlType(Type) is called with a null type. The premise of the PR might be incorrect and might need a closer look. Maybe this is for a future change not yet merged to the main branch? Could be I have this wrong. Here is a link to the source:
https://github.com/dotnet/wpf/blob/1346571efc19a83a90edf3abe9059d18f8412cdb/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Baml2006/WpfSharedXamlSchemaContext.cs#L18-L20
Thanks @wadepickett. That is a different, internal type, but I checked for modern .NET versions and yes, it does appear to throw ANE. @adegeo Do you know where the source code is for .NET Framework 4.7.2 for this method? |
XamlSchemaContext.GetXamlType(Type)currently throwsNullReferenceExceptionwhen called with a nullType, while the API docs listedArgumentNullException.GetXamlType(Type)exception documentation to match observed runtime behavior.typeexception fromArgumentNullExceptiontoNullReferenceException.Internal previews