Skip to content
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

ILC: Allow OOB reference to upgrade framework assembly #109988

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Nov 19, 2024

Fixes #109872, taking the approach @jkotas suggested in #108909 (comment).

Tested locally with the repro from #109872, using IlcBuildTasksPath to point to a local build of the task.

@@ -99,16 +100,20 @@ public override bool Execute()
var list = new List<ITaskItem>();
var assembliesToSkipPublish = new List<ITaskItem>();
var satelliteAssemblies = new List<ITaskItem>();
var nativeAotFrameworkAssembliesToUse = new HashSet<string>();
var nativeAotFrameworkAssembliesToUse = new Dictionary<string, ITaskItem>();
Copy link
Member

Choose a reason for hiding this comment

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

Should this use OrdinalIgnoreCase like some of the other path comparisons below? Or are the filenames guaranteed to have some sort of normalized casing?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it is needed since the comparison is done on file names which should use consistent casing between the framework and OOB packages. I tried breaking it by using Reference with casing that doesn't match the filename:

<Reference Include="C:\path\to\.nuget\packages\system.diagnostics.diagnosticsource\9.0.0\lib\net8.0\system.diagnostics.diagnosticsource.dll" />

but this breaks the build before we get to ILC (tried on windows and linux).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM!

I would be nice to have a test for this, but I do not have a good suggestion for where to add it.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Nice, thanks! I think there is now a theoretical chance that if someone manually specified an ILCompiler package to use and this package is older than the framework package, we wouldn't use anything from the ILCompiler package (even corelib would be CoreCLR's). I guess we can live with that, the failure mode should be easy to spot.

@MichalStrehovsky
Copy link
Member

I would be nice to have a test for this, but I do not have a good suggestion for where to add it.

Yeah, I don't have one either. Maybe if we created an assembly named system.diagnostics.diagnosticsource in a test and gave it version 100.0.0, it could work? Not sure.

@jkotas
Copy link
Member

jkotas commented Nov 20, 2024

even corelib would be CoreCLR's

Should we fails with a good error message for attempt to override CoreLib? I am sure that it is going to save some troubleshooting in future.

@sbomer
Copy link
Member Author

sbomer commented Nov 20, 2024

I hope this error message is good enough. It could be a little confusing because the intention of an old ILC reference is to override with an older version of SPC, but the message will suggest they tried to use a newer version. I hope putting the file paths in the message makes it clear.

@sbomer
Copy link
Member Author

sbomer commented Nov 20, 2024

Not sure we have a good place to test changes to the ILC build integration right now. The SDK has tests for the linker build integration even though the MSBuild logic now lives in runtime. We could do the same for ILC, but I'm not convinced it's worth it for this change - though I would definitely add tests when fixing #108909.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thank you!

@sbomer sbomer merged commit 36903dc into dotnet:main Nov 21, 2024
88 checks passed
@sbomer
Copy link
Member Author

sbomer commented Nov 21, 2024

/backport to release/9.0-staging

@sbomer
Copy link
Member Author

sbomer commented Nov 21, 2024

/backport to release/8.0-staging

Copy link
Contributor

Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/11959116638

Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/11959118198

@jamiewinder
Copy link

Hi all. Happy to see this is resolved. How do we go about applying this fix, is it a case of waiting for a fix version of the SDK to be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible System.Diagnostics.DiagnosticSource trimming issue
4 participants