Skip to content

System.Private.Xml AOT compatibility fixes - #76473

Merged
jkotas merged 9 commits into
dotnet:mainfrom
jkoritzinsky:linker-fixes-xml
Oct 4, 2022
Merged

System.Private.Xml AOT compatibility fixes#76473
jkotas merged 9 commits into
dotnet:mainfrom
jkoritzinsky:linker-fixes-xml

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

Add some annotations for ILC as discovered in #75793

@ghostghost added the area-System.Xml label Sep 30, 2022
@jkoritzinskyjkoritzinsky added the linkable-framework Issues associated with delivering a linker friendly framework label Sep 30, 2022
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-xml
See info in area-owners.md if you want to be subscribed.

Issue Details

Add some annotations for ILC as discovered in #75793

Author:jkoritzinsky
Assignees:-
Labels:

area-System.Xml

Milestone:-

@ghost

Copy link
Copy Markdown

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr
See info in area-owners.md if you want to be subscribed.

Issue Details

Add some annotations for ILC as discovered in #75793

Author:jkoritzinsky
Assignees:jkoritzinsky
Labels:

area-System.Xml, linkable-framework

Milestone:-

}

[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.")]

Copy link
Copy Markdown
Member

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(TypearrayType,intlength){Arrayarray=Array.CreateInstance(arrayType.GetElementType()!,length);Debug.Assert(array.GetType()==arrayType);returnarray;}

Copy link
Copy Markdown
Member

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.

Comment threadsrc/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs Outdated
Comment threadsrc/libraries/System.Net.Http/src/System/Net/Http/DiagnosticsHandler.cs Outdated
@radical

Copy link
Copy Markdown
Member

/azp run runtime-wasm-libtests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@eerhardteerhardt left a comment

Copy link
Copy Markdown
Member

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.

Comment threadsrc/libraries/System.Private.Xml/src/System/Xml/Schema/XmlValueConverter.cs Outdated
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@jkotas
jkotas merged commit 6294ab1 into dotnet:mainOct 4, 2022
@jkoritzinsky
jkoritzinsky deleted the linker-fixes-xml branch October 4, 2022 02:46
@ghostghost locked as resolved and limited conversation to collaborators Nov 3, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Xmllinkable-frameworkIssues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@jkoritzinsky@radical@jkotas@eerhardt