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
|
| } | ||
|
|
||
| [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.
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;
}
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). |
eerhardt
left a comment
There was a problem hiding this comment.
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