-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.Private.Xml AOT compatibility fixes #76473
Conversation
Tagging subscribers to this area: @dotnet/area-system-xml Issue DetailsAdd some annotations for ILC as discovered in #75793
|
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr Issue DetailsAdd some annotations for ILC as discovered in #75793
|
@@ -1088,6 +1089,8 @@ internal override RestrictionFlags ValidRestrictionFlags | |||
return exception; | |||
} | |||
|
|||
[UnconditionalSuppressMessage("AotAnalysis", "IL3050:AotUnfriendlyApi", | |||
Justification = "All types that are instantiated with this method are used elsewhere in this file in the implementations of the DatatypeImplementation abstract class.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that this warning is about values.ToArray(_itemType.ValueType)
. I think it works, but it fragile and hard to see that it is correct.
I would suggest factoring out the code that produces the Aot warning into a local method, apply the warning onto the local method only, and use the array type to create the array to guarantee that it is kept. Something like:
array = CreateArray(ListValueType);
values.CopyTo(array, 0);
...
[UnconditionalSuppressMessage("AotAnalysis", "Array type is passed as an argument to this method, so it is guaranteed to exist.")]
static Array CreateArray(Type arrayType, int length)
{
Array array = Array.CreateInstance(arrayType.GetElementType()!, length);
Debug.Assert(array.GetType() == arrayType);
return array;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #76478 to make this better.
src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-wasm-libtests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It would be good to get sign off from a System.Xml owner.
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs
Show resolved
Hide resolved
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
Show resolved
Hide resolved
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
src/libraries/System.Private.Xml/src/System/Xml/Schema/DataTypeImplementation.cs
Outdated
Show resolved
Hide resolved
…eImplementation.cs
Add some annotations for ILC as discovered in #75793