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

Use right hand side references even when not compatible #47065

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public static void QueueApiCompatFromContentItem(this IApiCompatRunner apiCompat
{
fallbackAssemblyReferences = rightPackage.FindBestAssemblyReferencesForFramework(leftTargetFramework);
}

// if we cannot find references for the left framework, then just use the same right references for the left assembly
if (fallbackAssemblyReferences is null && rightContentItems[0].Properties.TryGetValue("tfm", out tfmObj) && tfmObj is NuGetFramework rightTargetFramework)
{
fallbackAssemblyReferences = rightPackage.FindBestAssemblyReferencesForFramework(rightTargetFramework);
Copy link
Member Author

Choose a reason for hiding this comment

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

We might want to emit a diagnostic here. So long as all the types that were in the more-specific framework are in the less specific framework and are forwarded from the assembly name (excluding version) roslyn will still load them.

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean by "less-specific" and "more-specific"?

Copy link
Member Author

Choose a reason for hiding this comment

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

The direction of compatibility - newer versions being "more specific" also concrete frameworks being more specific than netstandard. Maybe newer is close enough, just glossing over the netstandard difference.

}
}

MetadataInformation[] left = new MetadataInformation[leftContentItems.Count];
Expand Down
Loading