Skip to content

Conversation

@jkurdek
Copy link
Contributor

@jkurdek jkurdek commented Aug 2, 2022

Removed suppressions identified as redundant by the linker (dotnet/linker#2922).

\cc @vitek-karas

@ghost ghost added area-Meta community-contribution Indicates that the PR has been added by a community member labels Aug 2, 2022
@ghost
Copy link

ghost commented Aug 2, 2022

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

Issue Details

Removed suppressions identified as redundant by the linker (dotnet/linker#2922).

\cc @vitek-karas

Author: jkurdek
Assignees: -
Labels:

area-Meta

Milestone: -

@tlakollo
Copy link
Contributor

tlakollo commented Aug 2, 2022

Yikes, I just added annotations with RDC and therefore more redundant suppressions x.x

@tlakollo tlakollo added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 2, 2022
@ghost
Copy link

ghost commented Aug 2, 2022

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

Removed suppressions identified as redundant by the linker (dotnet/linker#2922).

\cc @vitek-karas

Author: jkurdek
Assignees: jkurdek
Labels:

area-Meta, linkable-framework, community-contribution

Milestone: -

@tlakollo tlakollo removed area-Meta community-contribution Indicates that the PR has been added by a community member labels Aug 2, 2022
@tlakollo tlakollo requested a review from LakshanF August 2, 2022 18:56
@vitek-karas
Copy link
Member

Yikes, I just added annotations with RDC and therefore more redundant suppressions x.x

The current linker changes will not detect RDC related suppressions - for that we would have to port it over to NativeAOT and run the libraries through NativeAOT (somehow).

@vitek-karas vitek-karas requested a review from eerhardt August 8, 2022 12:18
@vitek-karas
Copy link
Member

@eerhardt: still a draft, but could you please take a look?

@jkurdek jkurdek marked this pull request as ready for review August 9, 2022 14:51
@ghost
Copy link

ghost commented Aug 11, 2022

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

Issue Details

Removed suppressions identified as redundant by the linker (dotnet/linker#2922).

\cc @vitek-karas

Author: jkurdek
Assignees: jkurdek
Labels:

area-Infrastructure-libraries, linkable-framework

Milestone: -


return matchingMethods[0];

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_transactionDispenser = localDispenser;
whereabouts = tmpWhereabouts;

[UnconditionalSuppressMessage("Trimming", "IL2050", Justification = "Leave me alone")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AaronRobinsonMSFT is this a leftover from your code review ;-) (it sounds like you)
In any case @jkurdek could you please change the Justification to something more professional - like "The PInvoke has object/interface typed parameters which are potentially trim incompatible, but in this case they're OK".

@AaronRobinsonMSFT - I don't know the details of the implicit COM interop , but I'm not actually sure this IS OK - There are two parameters which are potentially problematic:
pvConfigParams (typed as object) - but we're passing in null, so there's no trimming problem.
ppvObject which is declared as [MarshalAs(UnmanagedType.Interface)] out ITransactionDispenser ppvObject - my understanding is that the interop will take the managed definition of ITransactionDespenser and assume the vtable coming from native matches the managed definition. With trimming, that means we have to guarantee that we preserve the entire ITransactionDespenser as-is. Additionally the code will try to cast this to couple of other interface types (ITmNodeName, ITransactionImportWhereabouts and IResourceManagerFactory2) all of which will need the same treatment I guess.

Isn't this something which should use ComWrappers to be trim-compatible? I guess that is covered in #75031 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a leftover from your code review ;-) (it sounds like you)

100 % me, apologies. Please update as appropriate.

I don't know the details of the implicit COM interop

I think there was discussion that the Windows version of Transactions wasn't trim-compatible at all. However, how we express that isn't clear to me and at the time I was simply trying to get it to "leave me alone". Your analysis makes sense to me as far as why it may not be okay.

Isn't this something which should use ComWrappers to be trim-compatible? I guess that is covered in #75031 ?

From my conversations this particular part is a legacy or at the very least non-forward looking feature set that will not have a lot of investment in the future. It is unclear if ComWrappers will be worth the long term effort but perhaps #75031 is meant to track that conversation. @roji is the product owner here and can help guide us toward the correct solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, the unprofessional comment was my bad - @AaronRobinsonMSFT just proposed a draft PR with this, and I was supposed to change the text. Definitely go ahead and update as appropriate.

As @AaronRobinsonMSFT wrote, System.Transactions generally isn't a forward-looking components; the reason we ported the code containing the COM interop is to unblock .NET Framework users depending on distributed transactions and allow them to port to .NET. I very much doubt we'll invest more in this in the future; if we see a real need for a cross-platform API, we'll be implementing new support for that (#71769), but that likely wouldn't involve direct COM interop in any way.

I'll post a comment in #75031 clarifying the situation.

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2063:UnrecognizedReflectionPattern",
Justification = "Linker doesn't recognize always throwing method. https://github.com/mono/linker/issues/2025")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have references to this bug under src/coreclr/nativeaot as well - how was the redundant suppression analysis for NativeAOT done? I wonder why it didn't find those (they should be redundant because they were just a bug workaround).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The redundant warning suppression detection has not been ported to nativeaot yet (#75201). The suppression you mentioned should be identified after the functionality is ported and run witihin nativeaot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has a change in src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/General/Assignability.cs - what mechanism was used to detect it?

(NativeAOT doesn't run on code that is unreferenced and doesn't have a "library mode" like illink does - so the ability to detect redundant suppressions is somewhat limited even if we were to port the feature - we would have to come up with an app that includes all the code in NativeAOT's libraries. It will only flag things that are used, making it easy for us to ship with an actual warning that only some customers will see - customers who happen to use that part of the library.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was detected because linker was used to "trim libraries for warnings" (The sfx project run of linker) and it was given the AOT corelib as input. Jeremi found out that this happens when you run build Clr.Aot+Libs -rc Debug -lc Release, in which case linker gets artifacts\bin\coreclr\windows.x64.Debug\aotsdk\System.Private.CoreLib.dll as one of the input assemblies.

As for the comment about NativeAOT not having libraries mode - that should not matter. The detection works in the "trim app" mode as well - it only reports redundant warnings on methods which were "marked".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was detected because linker was used to "trim libraries for warnings" (The sfx project run of linker) and it was given the AOT corelib as input

I see, yes, there can only be one corelib project for the libs partition but we have 3 in this repo.

The corelib is selected here:

<CoreLibProject Condition="'$(RuntimeFlavor)' == 'CoreCLR'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<CoreLibProject Condition="'$(RuntimeFlavor)' == 'Mono'">$([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj'))</CoreLibProject>
<CoreLibProject Condition="'$(UseNativeAotCoreLib)' == 'true'">$([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'nativeaot', 'System.Private.CoreLib', 'src', 'System.Private.CoreLib.csproj'))</CoreLibProject>

@vitek-karas
Copy link
Member

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vitek-karas
Copy link
Member

Parts of the failures in WASM are #74413. (socket and http related failures)
The rest of the failures is #75223

@vitek-karas vitek-karas merged commit 8e2a059 into dotnet:main Sep 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Infrastructure-libraries linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants